PHP - restore_error_handler() 函式



語法

bool restore_error_handler ( void );

定義和用法

此函式用於在使用 set_error_handler() 更改錯誤處理程式函式後,恢復到以前的錯誤處理程式(可能是內建函式或使用者定義函式)。

引數

序號 引數及描述
1

void

返回值

此函式始終返回 TRUE。

示例

以下是此函式的用法:

<?php
   function unserialize_handler($errno, $errstr) {
      echo "Invalid hello value.\n";
   }
   
   $hello = 'abc';
   set_error_handler('unserialize_handler');
   
   $original = unserialize($hello);
   restore_error_handler();
?> 

這將產生以下結果:

Invalid hello value.
php_function_reference.htm
廣告