array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.restore-error-handler.php', 1 => 'restore_error_handler', ), 'up' => array ( 0 => 'ref.errorfunc.php', 1 => '错误处理 函数', ), 'prev' => array ( 0 => 'function.error-reporting.php', 1 => 'error_reporting', ), 'next' => array ( 0 => 'function.restore-exception-handler.php', 1 => 'restore_exception_handler', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/errorfunc/functions/restore-error-handler.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)
restore_error_handler — 还原之前的错误处理函数
在使用 set_error_handler() 改变错误处理函数之后,此函数可以 用于还原之前的错误处理程序(可以是内置的或者也可以是用户所定义的函数)。
此函数没有参数。
总是返回 true
。
示例 #1 restore_error_handler() 范例
如果是 unserialize() 导致了一个错误,接下来 会恢复原来的错误处理函数。
<?php
function unserialize_handler($errno, $errstr)
{
echo "Invalid serialized value.\n";
}
$serialized = 'foo';
set_error_handler('unserialize_handler');
$original = unserialize($serialized);
restore_error_handler();
?>
以上示例会输出:
Invalid serialized value.