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 红包祝福语简短10字
18 周六早晨祝福语简短