For example, if we want an admin directory,
we want to access
localhost/index.php/admin like this
Now thinkphp5 is installed to the specified directory
We found that there is a build.php file in the root directory, copy a copy to the application directory
open with notepad
The contents inside are:
return [
// 生成运行时目录
'__dir__' => ['runtime/cache', 'runtime/log', 'runtime/temp', 'runtime/template'],
'__file__' => ['common.php'],
// 定义index模块的自动生成
'index' => [
'__file__' => ['common.php'],
'__dir__' => ['behavior', 'controller', 'model', 'view'],
'controller' => ['Index', 'Test', 'UserType'],
'model' => [],
'view' => ['index/index'],
],
// 。。。 其他更多的模块定义
];
Use your eyes to find where index is in this code
After you find it, you can modify it
For example, if you want to name the front desk home, just change it directly to home
Then we use the command to execute php, execute it in the root directory (key)
php think build
Switch to the application directory, you will find that there is an additional directory in it
how to visit
In this way, you can modify the build.php in the application to create different sub-projects, such as api, admin, home.
Welcome to click the big penguin on the left