问题
Fatal error: Cannot access protected property JException::$code in /.../templates/abrax/error.php on line 14
Lines 14-17:
if (($this->error->code) == '404') {
header('Location: http://www.example.com/404');
exit;
}
回答1:
Use getters, you can't access property directly because it's visibility is not public
Like
if (($this->error->getCode()) == '404') {
...
回答2:
try this
if ($this->_error->get('code') == '404') {
header('Location: http://www.example.com/404');
exit;
}
来源:https://stackoverflow.com/questions/15870170/cannot-access-protected-property-jexceptioncode