在我的类构造函数中,我有以下代码:
在同一个类中,我定义了以下方法:
set_error_handler(array(
$this,
'_custom_error_handler'
));
在同一个类中,我定义了以下方法:
protected function _custom_error_handler($error_number, $error_string, $error_file, $error_line)
当我的代码运行时遇到错误,我会收到以下警告:
警告:无效的回调函数..._custom_error_handler,无法访问受保护的方法
为什么这个类(或它的子类?)不能访问这个受保护的方法?一个受保护的方法不应该是可访问的吗?
call_user_func()
的区别。 - Álvaro González