【发布时间】:2014-10-24 10:08:47
【问题描述】:
我有以下代码来设置我的错误/异常处理程序:
// Set the exception handler
set_exception_handler(function($e) {
echo 'Exception';
});
// Set the error handler
set_error_handler(function($code, $message, $file, $line) {
throw new ErrorException($message, 0, $code, $file, $line);
});
我读过很多文章,都说在 set_error_handler 回调函数中抛出异常。这应该意味着我只需要处理异常。但是 set_exception_handler 回调函数从未被调用,而是我收到警告:
警告:带有消息的未捕获异常“ErrorException”...
请注意,我使用的是 PHP 5.4。
【问题讨论】: