PHP restore_exception_handler() 函数
Example
Restore Exception Handler:
<?php // Two user-defined exception handling 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..."); ?>
The output of the above code is similar to this:
[myException1] This triggers the first exception handler...
Definition and Usage
The restore_exception_handler() function restores the previous exception handler.
After changing the exception handler with set_exception_handler(), this function can be used to restore the previous exception handler.
Tip:The previous exception handler can be either built-in or a user-defined function.
Syntax
restore_exception_handler();
Technical Details
Return Value: | Always returns TRUE. |
---|---|
PHP Version: | 5.0+ |