thinkphp5.0 Portal File

Source: Internet
Author: User

Entry file

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-dependent constants (optional)
    • Load frame entry file (required)

5.0 The default application portal file is located public/index.php with the following content:

// 定义应用目录define(‘APP_PATH‘, __DIR__ . ‘/../application/‘);// 加载框架引导文件require __DIR__ . ‘/../thinkphp/start.php‘;

Some system variables can also be defined in the portal file for related binding operations (typically used for multiple portals), which are later involved and are not mentioned.

APP_PATHdefining an absolute 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 , and the difference between the boot file and the one that start.php is not actively executing the app, but the need to do the application itself, here is an example:

// 定义应用目录define(‘APP_PATH‘, __DIR__ . ‘/../application/‘);// 加载框架基础引导文件require __DIR__ . ‘/../thinkphp/base.php‘;// 添加额外的代码// ...// 执行应用\think\App::run()->send();

thinkphp5.0 Portal File

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.