thinkphp报错Call to undefined method app\index\controller\Index::fetch()

因为要写一个系统,所以又重新下载了thinkphp,然后安装了一下。回忆起这个问题很容易让新手朋友费解。会出现如下报错: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();
    }
}

猜你喜欢

转载自www.cnblogs.com/nul1/p/10325940.html
今日推荐