【发布时间】:2018-06-04 10:55:09
【问题描述】:
我正在使用 cake php 3。几天前我已经将 php 版本从 5.6 更新到 7.1.17 。现在,如果我的应用程序发生任何错误,它会显示An Internal Server Error Occurred"。我可以在我的error.log 文件中看到错误日志,像这样[Error] Call to a member function user() on boolean
Request URL: /robots.txt
这是我的user() 函数的调用方式。它在 php 5.6 上运行良好..
public function beforeRender(Event $event)
{
if($this->Auth->user()){
$this->set('loggedIn', true);
}
else{
$this->set('loggedIn',false);
}
}
【问题讨论】:
-
调用 robots.txt 时为什么会出现这种情况?您是否尝试设置断点并调试 beforeRender() ?
标签: cakephp-3.0