restore_exception_handler()函数恢复之前定义过的异常处理函数。
bool restore_exception_handler ( void );
在使用set_exception_handler()更改异常处理程序函数之后,可以使用该函数恢复到先前的异常处理程序(可以是内置函数或用户定义的函数)。
| 序号 | 参数及说明 |
|---|---|
| 1 | void 无需参数 |
此函数始终返回TRUE。
restore_exception_handler()函数的使用示例:
<?php
function exception_handler_1(Exception $e)
{
echo '[' . __FUNCTION__ . '] ' . $e->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('这将触发第一个异常处理程序...');
?>测试看看 ‹/›[exception_handler_1] 这将触发第一个异常处理程序...