restore_exception_handler() 函數恢複之前的異常處理程序。它在使用 set_exception_handler() 更改異常處理程序函數後使用,以恢複到先前的異常處理程序(可以是 內置 或用戶定義的函數)。
用法
restore_exception_handler()
參數
- NA
返回
restore_exception_handler() 函數始終返回 TRUE。
示例
以下是一個例子 -
<?php
function customException1($exception) {
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
function customException2($exception) {
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
function customException3($exception) {
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
set_exception_handler("customException1");
set_exception_handler("customException2");
set_exception_handler("customException3");
restore_exception_handler();
// throwing exception
throw new Exception("Triggers the first exception handler!");
?>
輸出
以下是輸出 -
[customException1] Triggers the first exception handler!
相關用法
- PHP restore_error_handler()用法及代碼示例
- PHP reset()用法及代碼示例
- PHP rename( )用法及代碼示例
- PHP readfile( )用法及代碼示例
- PHP rewind( )用法及代碼示例
- PHP realpath_cache_get()用法及代碼示例
- PHP realpath( )用法及代碼示例
- PHP rewinddir()用法及代碼示例
- PHP read_exif_data()用法及代碼示例
- PHP readfile()用法及代碼示例
- PHP rename()用法及代碼示例
- PHP rewind()用法及代碼示例
- PHP readdir()用法及代碼示例
- PHP rmdir()用法及代碼示例
- PHP round()用法及代碼示例
- PHP random_int()用法及代碼示例
- PHP round( )用法及代碼示例
注:本文由純淨天空篩選整理自Karthikeya Boyini大神的英文原創作品 restore_exception_handler() function in PHP。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。