php try catch无法捕获运行时处理,通过使用set_error_handler手动抛出异常
<?php
set_error_handler ( "runtimeErrorHandler" );
function runtimeErrorHandler($errno, $errstr, $errfile, $errline) {
throw new Exception ( "errno:$errno|errstr:$errstr|errfile:$errfile|errline:$errline" );
}
try {
$a = 2 / 0;
} catch ( Exception $e ) {
echo '错误>>', $e->getMessage ();
}
?>