The previous article introduced you to "What are the two article loading paths in PHP? What is the file path? 》, this article continues to introduce to you what is error handling in PHP? Error code? Wrong trigger? It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Error handling:
refers to when the system (or user) executes certain codes , if an error is found, the programmer will be notified through
error handling.
Error classification:
1) Syntax error: The code written by the user does not comply with PHP's syntax specifications. Syntax errors will cause the code to fail during the compilation process, so The code will not execute (Parseerror).
2) Runtime error: The code is compiled successfully, but during the execution of the code there will be errors (runtime error) caused by unsatisfied conditions.
3) Logic errors: The programmer was not standardized enough when writing the code, and some logical errors occurred, causing the code to execute normally, but not getting the desired results,
$a= 10; If(Sa= 1){ //最常见把比较符号写成赋值符号 //执行代码。
Error code:
All error codes seen are defined as system constants in PHP (can be used directly).
1) System error:.
E_ PARSE: Compilation error, code will not be executed.
E_ ERROR: fatal error, a fatal error, will cause the code to not continue to execute correctly (break at the error location).
E_ WARNING: warning, warning error, will not affect code execution, but may get unexpected results.
E_ _NOTICE: notice, notification error, will not affect code execution.
2) User error:
E_ _USER ERROR,
E_ USER_ WARNING,
E_ _USER_ _NOTICE.
The error code the user will use when using a custom error trigger (the system will not use it).
3) Others:
E _ALL, which represents all slave errors (usually used more during error control), it is recommended that during the development process ( development environment).
All error constants (code names) starting with E are actually stored in one byte, and then each error occupies a bit corresponding to
. If you want to make some errors The control can be operated using bit operations.
Exclude notification level notice: E_ ALL& ~E_NOTICE.
Only warnings and notifications: E_ WARNING | E_ NOTICE.
Error trigger:The above is the detailed content of What is error handling in PHP? Error code? Wrong trigger?. For more information, please follow other related articles on the PHP Chinese website!