PHP restore_exception_handler() 函数


定义和用法

restore_exception_handler() 函数恢复之前的异常处理程序。

该函数用于在通过 set_exception_handler() 函数改变后恢复之前的异常处理程序。

该函数总是返回 TRUE。

语法

  1. restore_exception_handler()

提示和注释

提示:之前的异常处理程序可能是在内建的异常处理程序或用户自定义函数中构建的。

实例

  1. <?php
    restore_exception_handler();

    throw new Exception('Uncaught Exception occured');
    ?>

上面代码的输出如下所示:

  1. Fatal error: Uncaught exception 'Exception' with message
    'Uncaught Exception occured' in C:webfoldertest.php:4
    Stack trace: #0 {main} thrown in C:webfoldertest.php on line 4