1

致命错误:无法访问第 14 行 /.../templates/abrax/error.php 中的受保护属性 JException::$code

第 14-17 行:

if (($this->error->code) == '404') {
header('Location: http://www.example.com/404');
exit;
}
4

2 回答 2

2

Use getters, you can't access property directly because it's visibility is not public

Like

if (($this->error->getCode()) == '404') {
...
于 2013-04-08T07:36:53.637 回答
0

尝试这个

if ($this->_error->get('code') == '404') {
header('Location: http://www.example.com/404');
exit;
}

于 2015-04-14T10:17:55.350 回答