Restore exception handler example:
<?php
// Two user-defined exception handler functions
function myException1($exception) {
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
function myException2($exception) {
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
set_exception_handler("myException1");
set_exception_handler("myException2");
restore_exception_handler();
// Throw exception
throw new Exception("This triggers the first exception handler...");
?>
Try it Yourself »
The restore_exception_handler() function restores the previous exception handler.
This function is used to restore the previous exception handler after changing it with the set_exception_handler() function.
Tip: The previous exception handler could be the built-in exception handler or a user-defined exception handler function.
restore_exception_handler();
Return Value: | Always TRUE |
---|---|
PHP Version: | 5.0+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!