无法访问受保护的属性JException :: $ code [英] Cannot access protected property JException::$code
本文介绍了无法访问受保护的属性JException :: $ code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
致命错误:无法访问第14行/.../templates/abrax/error.php中受保护的属性JException :: $ code
Fatal error: Cannot access protected property JException::$code in /.../templates/abrax/error.php on line 14
第14-17行:
if (($this->error->code) == '404') {
header('Location: http://www.example.com/404');
exit;
}
推荐答案
使用吸气剂,您无法直接访问属性,因为它的可见性不是public
Use getters, you can't access property directly because it's visibility is not public
喜欢
if (($this->error->getCode()) == '404') {
...
这篇关于无法访问受保护的属性JException :: $ code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文