php restore_error_handler() function and restore_exception_handler() function

怪我咯
Release: 2023-03-13 12:10:02
Original
1216 people have browsed it

restore_error_handler— Restore the previouserror handlingFunction

Description

bool restore_error_handler ( void )
Copy after login

Change the error usingset_error_handler() After handling the function, this function can be used to restore the previous error handler (either a built-in or a user-defined function).

Return value

This function always returns TRUE.

restore_error_handler() example

If unserialize() causes an error, the original error handling function will be restored.

Copy after login

The above routine will output:

Invalid serialized value.
Copy after login

restore_exception_handler- Restore the previously definedException handlingfunction.

Description

bool restore_exception_handler ( void )
Copy after login

After usingset_exception_handler() to change the exception handling function, this function can be used to restore the previous exception handler (can be built-in or is a user-defined function).

Return value

This function always returns TRUE.

restore_exception_handler() function example

 getMessage (); } function exception_handler_2 ( Exception $e ) { echo '[' . FUNCTION . '] ' . $e -> getMessage (); } set_exception_handler ( 'exception_handler_1' ); set_exception_handler ( 'exception_handler_2' ); restore_exception_handler (); throw new Exception ( 'This triggers the first exception handler...' ); ?>
Copy after login

The above routine will output:

[exception_handler_1] This triggers the first exception handler...
Copy after login

The above is the detailed content of php restore_error_handler() function and restore_exception_handler() function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!