PHP 中的 restore_error_handler() 函数
phpprogrammingserver side programming更新于 2025/8/30 21:22:17
restore_error_handling() 函数用于恢复之前的错误处理程序。在使用 set_error_handler() 更改错误处理程序函数后,可以使用该函数恢复到之前的错误处理程序(可以是内置函数或用户定义函数)。
语法
restore_error_handler()
参数
不适用
返回值
restore_error_handler() 函数返回 TRUE。
示例
下面是一个例子 −
<?php
function unserialize_handler($errno, $errstr) {
echo "Custom error: Invalid hello value.
";
}
$hello = 'pqrs'; set_error_handler('unserialize_handler');
$original = unserialize($hello);
restore_error_handler();
?>
输出
Custom error: Invalid hello value.

