tp5错误日志输出:[ error ] [2]Declaration of app\Api::error($info) should be compatible with think\Controller::error($msg = '', $url = NULL, $data = '', $wait = 3, array $header = Array)
- 时间:
- 浏览:2696
- 来源:无双科技
在调试页面时,报错:
[ error ] [2]Declaration of app\Api::error($info) should be compatible with think\Controller::error($msg = '', $url = NULL, $data = '', $wait = 3, array $header = Array)
错误原因:
使用了tp中禁用的关键词作为方法名了,如此处的,error。将其改为error2或其它名称即可解决。
public function error2($info) {
// 返回错误
$attr = input();
$json = $this->info(false);
if (isset($info)) $json['info'] = $info;
return json($json);
}
同时引用的地方也要改过来
return $this->error2('参数错误');
猜你喜欢