thinkphp5报错Call to undefined method app\index\controller\Index::fetch解决方案
会出现如下报错:Call to undefined method app\index\controller\Index::fetch()
其实就是没找到fetch属性,其实默认是有这个属性的。只是你没有使用罢了。
需要先使用Controller然后继承。 如下所示:
<?php
namespace app\index\controller;
use think\Controller;
class Index extends Controller
{
public function index()
{
//加载视图文件
return $this->fetch();
}
}

博客指出出现Call to undefined method app\index\controller\Index::fetch()报错,原因是没找到fetch属性,虽默认有该属性但未使用。解决办法是先使用Controller然后继承。
1044

被折叠的 条评论
为什么被折叠?



