All error messages in PHP can be set using the Error_reporting () function:
Its parameters have a string and a number of two representations, a total of 14 levels, but, I think the use of other numbers seems to be able to, at first I thought it refers to a certain error interval, later, finally found the law:
Copy Code code as follows:
error_reporting (7) = error_reporting (1+2+4) = error_reporting (E_error | e_waring | E_parse)
Now, I'll summarize it as follows:
| Digital |
Constant |
Description |
| 1 |
E_error |
Fatal error, script execution interrupted, something unrecognizable in the script
Example: Error:invalid parameters. Invalid parameter name |
| 2 |
E_warning |
Partial code error, but does not affect overall operation
Example: Warning:require_once (e:/include/config_base.php) |
| 4 |
E_parse |
Error writing specification for character, variable, or end place
Example: Parse error:syntax error, unexpected $end in |
| 8 |
E_notice |
General notices, such as variables not defined, etc.
Example: notice:undefined variable:p in E:\web\index.php on line 17 |
| 16 |
E_core_error |
A fatal error occurred while the PHP process was starting
For example: temporary no |
| 32 |
E_core_warning |
Warning on PHP startup (non-fatal error)
For example: temporary no |
| 64 |
E_compile_error |
Compile-time fatal error
For example: temporary no |
| 128 |
E_compile_warning |
Compile-time Warning level error
For example: temporary no |
| 256 |
E_user_error |
User-defined error messages
For example: temporary no |
| 512 |
E_user_warning |
User-defined warning messages
For example: temporary no |
| 1024 |
E_user_notice |
User-Customized reminder messages
For example: temporary no |
| 2047 |
E_all |
All of the above error information, but does not include e_strict error information
For example: temporary no |
| 2048 |
E_strict |
Coding standardization warnings, which allow PHP to suggest how to modify the code to ensure optimal interoperability forward compatibility. |
The default value for the error_reporting variable is E_all & ~e_notice
At the time of development, the best value is: E_all | E_strict
If set to: Error_reporting (E_all | E_strict), indicates that all error messages are logged
May cause a lot of error codes on the Web site, but it's a good thing for programmers to optimize the code to the best; some non-fatal errors don't affect the running of the program, but can add to the burden of PHP.
Finally, the English version of the comparison table:
| 1 |
E_error |
Fatal run-time errors. Errors that can is recovered from. Execution of the script is halted |
| 2 |
E_warning |
Non-fatal run-time errors. Execution of the script is not halted |
| 4 |
E_parse |
Compile-time parse errors. Parse errors should is generated by the parser |
| 8 |
E_notice |
Run-time notices. The script found something that might is an error, but could also-happen when running a script normally |
| 16 |
E_core_error |
Fatal errors at PHP startup. This are like a e_error in the PHP core |
| 32 |
E_core_warning |
Non-fatal errors at PHP startup. This are like a e_warning in the PHP core |
| 64 |
E_compile_error |
Fatal compile-time errors. This are like a e_error generated by the Zend scripting Engine |
| 128 |
E_compile_warning |
Non-fatal compile-time errors. This are like a e_warning generated by the Zend scripting Engine |
| 256 |
E_user_error |
Fatal user-generated error. This are like a e_error set by the programmer using the PHP function Trigger_error () |
| 512 |
E_user_warning |
Non-fatal user-generated warning. This are like a e_warning set by the programmer using the PHP function Trigger_error () |
| 1024 |
E_user_notice |
user-generated notice. This are like a e_notice set by the programmer using the PHP function Trigger_error () |
| 2048 |
E_strict |
Run-time notices. PHP suggest changes to your code to help interoperability and compatibility of the code |
| 4096 |
E_recoverable_error |
Catchable fatal error. This is the e_error but can be caught by a user defined handle (* also Set_error_handler ()) |
| 8191 |
e_all |
All errors and warnings, except level e_strict (E_strict'll is part of E_all As of PHP 6.0) |