In many cases, php files may encounter some very difficult-to-troubleshoot errors, such as output of large white pages. It is possible that the PHP error level shields some non-fatal errors, resulting in no error prompt. Therefore, understanding and familiarity with PHP error levels may become a new method for debugging errors. In php. ini, the error report level is E_NOTICE by default.
In many cases, php files may encounter some very difficult-to-troubleshoot errors, such as output of large white pages. It is possible that the PHP error level shields some non-fatal errors, resulting in no error prompt. Therefore, understanding and familiarity with PHP error levels may become a new method for debugging errors.
Php. by default, the PHP error reporting level is E_NOTICE, and E_ALL indicates reporting all non-fatal errors, because these errors may cause major problems (such as using undefined variables ).
All errors are displayed, except reminders and coding standard warnings.
The error report is a bit field. You can add up the numbers to get the expected error report level.
E_ALL-all errors and warnings (excluding E_STRICT) E_ERROR-fatal runtime error E_WARNING-runtime warning (non-fatal error) e_PARSE-parsing error during compilation E_NOTICE-runtime reminder (these are often caused by bugs in your code and may also be caused by intentional behavior .) E_STRICT-code standardization warning, allowing PHP to recommend how to modify code to ensure optimal interoperability forward compatibility. E_CORE_ERROR-fatal error during PHP initialization E_CORE_WARNING-warning during PHP startup (non-fatal error) E_COMPILE_ERROR-fatal error during compilation E_COMPILE_WARNING-warning during compilation (non-fatal error) e_USER_ERROR-custom error message E_USER_WARNING-custom warning message E_USER_NOTICE-custom reminder message
If it is set to: E_ALL | E_STRICT, it indicates to record all the error information, which may lead to a lot of error code on the website. but it should be said to be a good thing for programmers, you can optimize the code to the optimum. some non-fatal errors do not affect the running of the program, but increase the burden on PHP, usually increasing the website process (such as the application pool of IIS).
Bytes --------------------------------------------------------------------------------------------------
Adjust error reports in PHP
Once you set PHP to display the errors that have occurred, you may want to adjust the error report level. You can set the PHP installation as a whole or as an independent script to report or ignore different error levels. Table 7-1 lists most levels, but they are generally one of the following three levels:
L ??? Note (notice), which does not prevent script execution and may not be a problem;
L ??? Warning, which indicates a problem, but does not prevent the execution of the script;
L ??? Error, which prevents the script from continuing to run (including common parsing errors, which fundamentally stop the script from running ).
Table 7-1? PHP error report settings, used together with the error_reporting () function, or in the php. ini file. Note that the value of E_ALL is different from that of the old PHP version and does not include E_STRICT (but exists in PHP 6)
Editing ??? No. |
Often ??? Quantity |
Report ??? Notice |
1 |
E_ERROR |
Fatal runtime error (it will prevent script execution) |
2 |
E_WARNING |
Runtime warning (non-fatal error) |
(Continued)
Editing ??? No. |
Often ??? Quantity |
Report ??? Notice |
4 |
E_PARSE |
Parsing error |
8 |
E_NOTICE |
Note (things may or may not be a problem) |
256 |
E_USER_ERROR |
The error message generated by the trigger_error () function. |
512 |
E_USER_WARNING |
User-generated warning, generated by trigger_error () function |
1024 |
E_USER_NOTICE |
Attention generated by the user, generated by the trigger_error () function |
2048 |
E_STRICT |
Suggestions on compatibility and interoperability |
8191 |
E_ALL |
All errors, warnings, and suggestions |