`

PHP Error 和 Logging 函数

 
阅读更多

PHP Error 和 Logging 简介

error 和 logging 函数允许你对错误进行处理和记录。

error 函数允许用户定义错误处理规则,并修改记录错误的方式。

logging 函数允许用户对应用程序进行日志记录,并把日志消息发送到电子邮件、系统日志或其他的机器。

安装

error 和 logging 函数是 PHP 核心的组成部分。无需安装即可使用这些函数。

PHP Error 和 Logging 函数

PHP:指示支持该函数的最早的 PHP 版本。

函数 描述 PHP
debug_backtrace() 生成 backtrace。 4
debug_print_backtrace() 输出 backtrace。 5
error_get_last() 获得最后发生的错误。 5
error_log() 向服务器错误记录、文件或远程目标发送一个错误。 4
error_reporting() 规定报告哪个错误。 4
restore_error_handler() 恢复之前的错误处理程序。 4
restore_exception_handler() 恢复之前的异常处理程序。 5
set_error_handler() 设置用户自定义的错误处理函数。 4
set_exception_handler() 设置用户自定义的异常处理函数。 5
trigger_error() 创建用户自定义的错误消息。 4
user_error() trigger_error() 的别名。 4

PHP Error 和 Logging 常量

PHP:指示支持该常量的最早的 PHP 版本。

值 常量 描述 PHP
1 E_ERROR 致命的运行时错误。错误无法恢复。脚本的执行被中断。
2 E_WARNING 非致命的运行时错误。脚本的执行不会中断。
4 E_PARSE 编译时语法解析错误。解析错误只应该由解析器生成。
8 E_NOTICE 运行时提示。可能是错误,也可能在正常运行脚本时发生。
16 E_CORE_ERROR 由 PHP 内部生成的错误。 4
32 E_CORE_WARNING 由 PHP 内部生成的警告。 4
64 E_COMPILE_ERROR 由 Zend 脚本引擎内部生成的错误。 4
128 E_COMPILE_WARNING 由 Zend 脚本引擎内部生成的警告。 4
256 E_USER_ERROR 由于调用 trigger_error() 函数生成的运行时错误。 4
512 E_USER_WARNING 由于调用 trigger_error() 函数生成的运行时警告。 4
1024 E_USER_NOTICE 由于调用 trigger_error() 函数生成的运行时提示。 4
2048 E_STRICT 运行时提示。对增强代码的互用性和兼容性有益。 5
4096 E_RECOVERABLE_ERROR 可捕获的致命错误。(参阅 set_error_handler()) 5
8191 E_ALL 所有的错误和警告,除了 E_STRICT。 5
分享到:
评论

相关推荐

    PHP Error与Logging函数的深入理解

    PHP Error与Logging 简介error与logging 函数允许你对错误进行处理和记录。error 函数允许用户定义错误处理规则,并修改记录错误的方式。logging 函数允许用户对应用程序进行日志记录,并把日志消息发送到电子邮件、...

    PHP函数参考手册大全

    Error Handling and Logging Functions XXXII. Exif Functions XXXIII. File Alteration Monitor Functions XXXIV. filePro Functions XXXV. Filesystem 文件系统函数 XXXVI. Firebird/InterBase Functions XXXVII....

    PHP 日志缩略名的创建函数代码

    php实现的简单日志写入函数PHP调试函数和日志记录函数分享php基于自定义函数记录log日志方法php error_log 函数的使用PHP error_log()将错误信息写入一个文件(定义和用法)PHP中error_log()函数的使用方法PHP Error与...

    php帮助文档,php。chm,php必备的中文手册

    Error Handling and Logging Functions XXXIII. Exif Functions XXXIV. Expect Functions XXXV. File Alteration Monitor Functions XXXVI. Forms Data Format Functions XXXVII. filePro Functions XXXVIII. ...

    php手册.chm,php手册

    Error Handling and Logging Functions XXXII. Exif Functions XXXIII. File Alteration Monitor Functions XXXIV. filePro Functions XXXV. Filesystem 文件系统函数 XXXVI. Firebird/InterBase Functions XXXVII....

    php中文完全开发手册

    Error Handling and Logging Functions XXVII. File Alteration Monitor Functions XXVIII. FrontBase Functions XXIX. filePro Functions XXX. 文件系统函数库 XXXI. Forms Data Format Functions XXXII. FriBiDi ...

    PHP5 完整官方 中文教程

    Errors and Logging — Error Handling and Logging Functions Exif — Exif Functions Expect — Expect Functions fam — File Alteration Monitor Functions FDF — Forms Data Format Functions Fileinfo — ...

    中文版PHP使用手册

    Error Handling and Logging Functions XXXII. Exif Functions XXXIII. File Alteration Monitor Functions XXXIV. filePro Functions XXXV. Filesystem 文件系统函数 XXXVI. Firebird/InterBase Functions XXXVII....

    PHP手册2007整合中文版

    Error Handling and Logging Functions XXXV. Exif Functions XXXVI. Expect Functions XXXVII. File Alteration Monitor Functions XXXVIII. Forms Data Format Functions XXXIX. Fileinfo Functions XL. filePro ...

    PHP官方手册中文版

    Error Handling and Logging Functions XXXV. Exif Functions XXXVI. Expect Functions XXXVII. File Alteration Monitor Functions XXXVIII. Forms Data Format Functions XXXIX. Fileinfo Functions XL. ...

    php手册PHP5研究室编无乱码版本chm

    Error Handling and Logging Functions XXXII. Exif Functions XXXIII. File Alteration Monitor Functions XXXIV. filePro Functions XXXV. Filesystem 文件系统函数 XXXVI. Firebird/InterBase Functions ...

    PHP5中文参考手册

    Errors and Logging — Error Handling and Logging Functions Exif — Exif Functions Expect — Expect Functions fam — File Alteration Monitor Functions FDF — Forms Data Format Functions Fileinfo — ...

    PHP5 开发手册 简体中文手册

    Error Handling and Logging Functions XXXIII. Exif Functions XXXIV. Expect Functions XXXV. File Alteration Monitor Functions XXXVI. Forms Data Format Functions XXXVII. filePro Functions XXXVIII. ...

    经典收藏最全php5.0查询手册

    Error Handling and Logging Functions XXXII. Exif Functions XXXIII. File Alteration Monitor Functions XXXIV. filePro Functions XXXV. Filesystem 文件系统函数 XXXVI. Firebird/InterBase Functions XXXVII....

    PHP手册(带评论版-2008-03-14).part2.rar

    Error Handling and Logging Functions XXXII. Exif Functions XXXIII. File Alteration Monitor Functions XXXIV. filePro Functions XXXV. Filesystem 文件系统函数 XXXVI. Firebird/InterBase Functions XXXVII....

    PHP手册(带评论版-2008-03-14).part1.rar

    Error Handling and Logging Functions XXXII. Exif Functions XXXIII. File Alteration Monitor Functions XXXIV. filePro Functions XXXV. Filesystem 文件系统函数 XXXVI. Firebird/InterBase Functions XXXVII....

    PHP基础教程 是一个比较有价值的PHP新手教程!

    其他一些对数组或哈希表有用的函数包括sort(),next(),prev()和each()。 对象 使用new语句产生一个对象: class foo { function do_foo () { echo "Doing foo."; } } $bar = new foo; $bar->do_foo(); 改变变量...

    laravel5.6版本下载

    如果你想要定义一个完整的自定义频道从而可以完全控制 Monolog 的实例化和配置,可以在配置文件 config/logging.php 中指定一个 custom 驱动类型。此外,你的配置中还要包含一个 via 项来指定被调用来创建 Monolog ...

    模拟:高度可扩展且易于使用PHP日志记录库

    模拟-最小PHP日志记录库版权:(c)2012-至今Johnny Broadway 执照:一个基于将闭包用于可配置性和可扩展性的思想的最小PHP日志记录程序包。 它起静态类的作用,但是您可以通过闭包函数(也称为)完全控制日志消息的...

Global site tag (gtag.js) - Google Analytics