导航首页 » 技术教程 » PHP异常处理:error_get_last()函数的用法
PHP异常处理:error_get_last()函数的用法 143 2023-12-14   

error_get_last

(PHP 5 >= 5.2.0)

error_get_last — 获取最后发生的错误

说明

array error_get_last ( void )

获取关于最后一个发生的错误的信息。

返回值

返回了一个关联数组,描述了最后错误的信息,以该错误的 "type"、 "message"、"file" 和 "line" 为数组的键。 如果该错误由 PHP 内置函数导致的,"message"会以该函数名开头。 如果还没有错误则返回 NULL

范例

Example #1 An error_get_last() 范例

<?php
echo $a;
print_r(error_get_last());
?>

以上例程的输出类似于:

Array
(
    [type] => 8
    [message] => Undefined variable: a
    [file] => C:WWWindex.php
    [line] => 2
)

参见

Error constants Variable $php_errormsg Directive display_errors Directive html_errors Directive xmlrpc_errors


!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103