Thinkphp uses a single entry mode for project deployment and access, and regardless of what functionality is completed, an application has a unified (but not necessarily unique) portal.
It should be said that all applications start with a portal file, and the entry files for different applications are similar.
Portal file Definition
The entry file is mainly completed:
- define frame path, project path (optional)
- define system-related constants (optional)
- Load Frame entry file (required)
5.0 The default application entry file is located in public/index.php with the following contents:
//definition App directory define ( ' App_path ', __ dir__. //load frame boot file require __DIR__. Span class= "hljs-string" "/". /thinkphp/start.php ';
Portal file location is designed to make application deployment more secure,
public directory is a Web-accessible directory, and other files can be placed under a non-Web Access directory.
To modify the location of the portal file, see Chapter < deployment-Virtual host environment ;
Portal file can also be used to define system variables for related binding operations (typically used for multiple portals), which are later involved and are not mentioned.
Defining an absolute path to app_path increases the efficiency of the system's loading.
In some cases, you may need to load the framework's underlying boot file base.php , the boot file and start.php is that it does not actively execute the application, but rather it needs to perform its own application, and here is an example:
// 定义应用目录define(‘APP_PATH‘, __DIR__ . ‘/../application/‘);// 加载框架基础引导文件require __DIR__ . ‘/../thinkphp/base.php‘;// 添加额外的代码// ...// 执行应用\think\App::run()->send();
thinkphp5.0 Portal File