杰克不接客
2017-09-11 06:43
<?php namespace app\index\controller; use think\Controller; use think\Request; class Index extends Controller { public function __construct(){ config('before', 'beforeAction'); } public function index(Request $request) { return $this->fetch(); } }
上面的代码,直接跑会报一个‘
Call to a member function fetch() on a non-object
’的错误,但是删除掉construct函数后就没问题了,请问这个是怎么没一个情况?
你需要添加一行 parent::__construct();
快速入门ThinkPHP 5.0--基础篇
58761 学习 · 503 问题
相似问题