先上代码
<?php
namespace app\index\controller;//注意我这里是index应用下的,官方默认直接就controller
use app\BaseController;
use think\facade\View;
class Index extends BaseController
{
public function index()
{
return View::fetch();
// var_dump('123');
}
}
打开之后,没找到配置的默认访问应用模块,查了资料要多应用
老规矩composer安装扩展
composer require topthink/think-multi-app
然后。。。又报错了,可能是view渲染问题,继续查资料
接着敲安装扩展
composer require topthink/think-view
ok,又换错误了,开始以为是没有指定模板路径,结果查资料发现,runtime要777权限,打开就好了