返回最后发生的错误:
<?php
echo $test;
print_r(error_get_last());
?>
以上代码的输出类似这样:
Array
(
[type] => 8
[message] => Undefined variable: test
[file] => C:\webfolder\test.php
[line] => 2
)
error_get_last() 函数返回最后发生的错误(以关联数组的形式)。
关联数组包含四个键:
error_get_last();
返回值: | 返回了一个关联数组,描述了最后错误的信息,以该错误的 "type"、 "message"、"file" 和 "line" 为数组的键。 如果该错误由 PHP 内置函数导致的,"message"会以该函数名开头。 如果还没有错误则返回 NULL。 |
---|---|
PHP 版本: | 5.2+ |
©2020 IT自习室京ICP备20010815号