Article Directory
1.thinkphp5 entry file Profile
Speaking entry file, we first have to know what it is, on the pair of.
First, ThinkPHP single entrance and access to project deployment model, no matter what the function is complete, an application has a unified (but not necessarily the only) entry, thinkphp5 default entry file is located public/index.php
.
It should be said 所有应用都是从入口文件开始的
, and import documents of different applications are similar.
Throughout the application 生命周期
, the 第一步执行的就是入口文件
request will be initiated by the user through the inlet of the application file, typically public/index.php
a file. Of course, you can also change or add a new entry file.
The default entry file index.php
code is as follows:
// 应用入口文件
// 定义项目路径
define('APP_PATH', __DIR__ . '/../application/');
// 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php';
2. Visit the website root directory www
When we finished installing phpstudy, will thinkphp5 into the root of the site www folder, we've got to test it, we have not successfully pair of thinkphp5 in the end configuration, there are two ways we can be tested.
(1) localhost visit the Web site www root directory
In the browser address bar
http://localhost/thinkphp5/public/
and it will automatically have access to thehttp://localhost/thinkphp5/public/index/index/index
first entrance into the server file index.php, and then enter the index module, find the index controller, which then call the index () method. Specifically see FIG.
Results of the:
- Here you will certainly see A pair of curious, why can index it omitted? Because thinkphp5 application configuration file
config.php
these within the parameters have default settings, so do not enter the three index, enter one or two index universally accessible to the index () method, let's look at the config.php configuration on the subject.
(2) Configuration visit the Web site domain name root directory www
This step we have to configure the domain name need to use this powerful APP phpstudy it!
Step one: Click the site domain management
Step Two: Set Name
Domain: Set yourself a random, in accordance with the
www.xxxx.com
format;
website directory:D:\phpStudy\WWW\thinkphp5\public
(must be a public directory under the file you thinkphp5 set at www directory, which is my own file directory);
second domain name: It is also referred to as sub domain names, access it and access the main domain name is the same effect;
Web site port: default, we do not move it;
and finally click新增,保存并生成配置文件;
Step 3: Check whether the configuration domain
We can view the vhosts-conf
profiles to see if the configuration is successful.
Step Four: Configure hosts
The domain name just configured, configure the hosts file.