restore_error_handler()函數(shù)還原之前的錯誤處理函數(shù)
bool restore_error_handler ( void );
在使用 set_error_handler() 改變錯誤處理函數(shù)之后,此函數(shù)可以 用于還原之前的錯誤處理程序(可以是內(nèi)置的或者也可以是用戶所定義的函數(shù))。
序號 | 參數(shù)及說明 |
---|---|
1 | void 無需參數(shù) |
此函數(shù)始終返回TRUE。
以下是此函數(shù)的用法, 如果 unserialize() 導(dǎo)致了一個錯誤,接下來 會恢復(fù)原來的錯誤處理函數(shù)。
<?php function unserialize_handler($errno, $errstr) { echo "無效的hello值。\n"; } $hello = 'abc'; set_error_handler('unserialize_handler'); $original = unserialize($hello); restore_error_handler(); ?>測試看看?/?
這將產(chǎn)生以下結(jié)果-
無效的hello值。