array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.error-clear-last.php', 1 => 'error_clear_last', ), 'up' => array ( 0 => 'ref.errorfunc.php', 1 => '错误处理 函数', ), 'prev' => array ( 0 => 'function.debug-print-backtrace.php', 1 => 'debug_print_backtrace', ), 'next' => array ( 0 => 'function.error-get-last.php', 1 => 'error_get_last', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/errorfunc/functions/error-clear-last.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7, PHP 8)
error_clear_last — 清除最近一次错误
此函数没有参数。
清除最近一次错误,使它无法通过 error_get_last() 获取。
示例 #1 error_clear_last() 例子
<?php
var_dump(error_get_last());
error_clear_last();
var_dump(error_get_last());
@$a = $b;
var_dump(error_get_last());
error_clear_last();
var_dump(error_get_last());
?>
以上示例的输出类似于:
NULL NULL array(4) { ["type"]=> int(8) ["message"]=> string(21) "Undefined variable: b" ["file"]=> string(9) "%s" ["line"]=> int(6) } NULL