1.thinkPHP官网下载 好后解压到web运行环境下
2。在目录中找到build.php文件
return [
// 生成应用公共文件
'__file__' => ['common.php', 'config.php', 'database.php'],
// lopo就是你要建立的项目模块的名称
'lopo' => [
'__file__' => ['common.php'],
'__dir__' => ['behavior', 'controller', 'model', 'view'],//创建lopo下的文件夹名称
'controller' => ['Index', 'Test', 'UserType'],//控制器的名称
'model' => ['User', 'UserType'],
'view' => ['index/index'],/
],
// 其他更多的模块定义
];
3.修改public下的index.php文件:
// 读取自动生成定义文件
$build = include '/../build.php';
// 运行自动生成
\think\Build::run($build);
4.运行localhost/thinkphp5/public/index.php目录lopo就生成了。
【注意】:thinkPHP5 要加载模板文件时要引用控制器类use think\Controller;再集成控制器
class Lopo extends Controller
{
public function index()
{
return $this->fetch();
}
}