-
- * For now, avoid warnings of E_STRICT mode
- * (this must be done before function definitions)
- */
- if (defined(’E_STRICT’)) {
- $old_error_reporting = error_reporting(0);
- if ($old_error_reporting & E_STRICT) {
- error_reporting($old_error_reporting ^ E_STRICT);
- } else {
- error_reporting($old_error_reporting);
- }
- unset($old_error_reporting);
复制代码
常见的如下:
-
-
// Turn off all error reporting;关闭所有的错误
- error_reporting(0);
// Report simple running errors;报告一个简单的运行错误
- error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Reporting E_NOTICE can be good too (to report uninitialized
- // variables or catch variable name misspellings …);包括报告一些未初始化的变量或捕捉变量名的拼写错误
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
- // Report all errors except E_NOTICE
- // This is the default value set in php.ini;报告所有的错误但不包括E_NOTICE
error_reporting(E_ALL ^ E_NOTICE);
- // Report all PHP errors (bitwise 63 may be used in PHP 3);报告所有的错误
error_reporting(E_ALL);
- // Same as error_reporting(E_ALL);同上
- ini_set(’error_reporting’, E_ALL);
-
复制代码
|