【发布时间】:2011-10-21 11:33:18
【问题描述】:
在我的开发机器中,我将 error_reporting 设置为 E_ALL | E_STRICT 以查看我的代码中发生的所有错误消息。
但是当我处理捕获的异常时:
try {
throw new MyException('Exception message.');
} catch (MyException $e) {
// code that handles the exception but without print anything
}
PHP 总是显示错误信息:
MyException: Exception message in file://path/to/failed/file.php
之后 PHP 无法发送新的标头。
您知道一些方法来避免自动生成的 PHP 错误被引发但被捕获的 display_errors=On 和 error_reporting=E_ALL |E_STRICT 异常显示吗?
【问题讨论】: