PHP中的error_get_last()函数
error_get_last()函数获取最后一个作为关联数组发生的错误。关联数组包含四个键-
[类型]-描述错误类型
[消息]-描述错误消息
[文件]-描述发生错误的文件
[行]-描述发生错误的行
语法
error_get_last()
参数
不适用
返回
error_get_last()函数返回一个关联数组,该数组用键“type”,“message”,“file”和“line”描述最后的错误。如果还没有错误,则返回NULL。
示例
以下是一个例子-
<?php echo $res; print_r(error_get_last()); ?>
输出结果
以下是输出。在这里,我们在关联数组中显示错误-
Array ( [type] => 8 [message] => Undefined variable: res [file] => /home/cg/root/4127336/main.php [line] => 2 ) PHP Notice: Undefined variable: res in /home/cg/root/4127336/main.php on line 2
热门推荐
10 小红书平安祝福语简短
11 生日祝福语大全女孩简短
12 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语