error_reporting用法

来源:互联网 发布:多米cms 编辑:程序博客网 时间:2024/06/02 08:52
 

用法:设置 PHP 的报错级别并返回当前级别。

语法

error_reporting(report_level)

 

如果参数 level 未指定,当前报错级别将被返回。下面几项是 level 可能的值:

值常量描述1E_ERROR

Fatal run-time errors. Errors that can not be recovered from. Execution of the script is halted

运行是的致命错误,错误不可恢复,脚本停止执行!

2E_WARNING

Non-fatal run-time errors. Execution of the script is not halted

不是致命错误,脚本不会停止运行。

4E_PARSE

Compile-time parse errors. Parse errors should only be generated by the parser

编译时错误,解析错误应该由编译器产生。

8E_NOTICERun-time notices. The script found something that might be an error, but could also happen when running a script normally16E_CORE_ERRORFatal errors at PHP startup. This is like an E_ERROR in the PHP core32E_CORE_WARNINGNon-fatal errors at PHP startup. This is like an E_WARNING in the PHP core64E_COMPILE_ERRORFatal compile-time errors. This is like an E_ERROR generated by the Zend Scripting Engine128E_COMPILE_WARNINGNon-fatal compile-time errors. This is like an E_WARNING generated by the Zend Scripting Engine256E_USER_ERRORFatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error()512E_USER_WARNINGNon-fatal user-generated warning. This is like an E_WARNING set by the programmer using the PHP function trigger_error()1024E_USER_NOTICEUser-generated notice. This is like an E_NOTICE set by the programmer using the PHP function trigger_error()2048E_STRICTRun-time notices. PHP suggest changes to your code to help interoperability and compatibility of the code4096E_RECOVERABLE_ERRORCatchable fatal error. This is like an E_ERROR but can be caught by a user defined handle (see also set_error_handler())8191E_ALLAll errors and warnings, except level E_STRICT (E_STRICT will be part of E_ALL as of PHP 6.0)
原创粉丝点击