set_exception_handler 设置用户自定义的异常处理函数 &reftitle.description; callablenullset_exception_handler callablenullcallback 设置默认的异常处理程序,用于没有用 try/catch 块来捕获的异常。 在 callback 调用后异常会中止。 &reftitle.parameters; callback 当一个未捕获的异常发生时所调用的函数。该处理函数需要接受一个参数,该参数是抛出的 Throwable 对象。ErrorException 都实现了 Throwable 接口。这是处理程序签名: voidhandler Throwableex 也可以传递 &null; 值用于重置异常处理函数为默认值。 &reftitle.returnvalues; 返回之前定义的异常处理程序,或者在错误时返回 &null;。如果之前没有定义错误处理程序,也会返回 &null;。 &reftitle.examples; <function>set_exception_handler</function> 范例 getMessage(), "\n"; } set_exception_handler('exception_handler'); throw new Exception('Uncaught Exception'); echo "Not Executed\n"; ?> ]]> &reftitle.seealso; get_exception_handler restore_exception_handler restore_error_handler error_reporting 异常