thinkphp5报错Call to undefined method app\index\controller\Index::fetch()解决方案

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();
    }
}

猜你喜欢

转载自blog.csdn.net/guo_qiangqiang/article/details/114173279