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

超、凢脫俗 2022-11-03 10:38 375阅读 0赞

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

会出现如下报错:Call to undefined method app\index\controller\Index::fetch()

其实就是没找到fetch属性,其实默认是有这个属性的。只是你没有使用罢了。

需要先使用Controller然后继承。 如下所示:

  1. <?php
  2. namespace app\index\controller;
  3. use think\Controller;
  4. class Index extends Controller
  5. {
  6. public function index()
  7. {
  8. //加载视图文件
  9. return $this->fetch();
  10. }
  11. }

发表评论

表情:
评论列表 (有 0 条评论,375人围观)

还没有评论,来说两句吧...

相关阅读