restore_exception_handler()函數(shù)恢復(fù)之前定義過(guò)的異常處理函數(shù)。
bool restore_exception_handler ( void );
在使用set_exception_handler()更改異常處理程序函數(shù)之后,可以使用該函數(shù)恢復(fù)到先前的異常處理程序(可以是內(nèi)置函數(shù)或用戶定義的函數(shù))。
| 序號(hào) | 參數(shù)及說(shuō)明 |
|---|---|
| 1 | void 無(wú)需參數(shù) |
此函數(shù)始終返回TRUE。
restore_exception_handler()函數(shù)的使用示例:
<?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('這將觸發(fā)第一個(gè)異常處理程序...');
?>測(cè)試看看 ?/?[exception_handler_1] 這將觸發(fā)第一個(gè)異常處理程序...