__Contruct()错误
<?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函数后就没问题了,请问这个是怎么没一个情况?