In the course of PHP programming, you will encounter more or less error reminders, it is these error hints, guide us to write cleaner code, today first write our main list of error types, first dig pits, write about PHP errors and anomalies related knowledge, slowly pits.
-
Deprecated lowest level error, program continues execution
-
Notice notification level errors such as using undeclared variables directly, the program continues execution
-
Warning Warning Level error, may not get the desired result
-
Fatal error fatal level error fatal level errors, program does not execute down
-
Parse error syntax parsing errors, highest level errors, and even other error messages are not rendered
-
E_user_ related error user settings related errors
Use the Trigger_error () function to set a user-level error/warning/notice information
How do I set the error level?
to modify the error level:
1:php.ini Modify the error_reporting option
2: You can use the error_reporting () function in the PHP page to modify the
The br> error level is represented by a 2 binary value: 1111 1111 1111 111 from left to right, 1 on each bit, representing an error level
fatal error fatal: 0000 0000 0000 001 Open 1
Warning Warning error: 0000 0000 0000 010 on 2
NOTICE warning: 0000 0000 0001 000 Open 8
Eg:
all reported : ER Ror_reporting (11);
do not report notice : error_reporting (3);
Any error is not reported to : error_reporting (0);
The system replaces the values for each level with system constants.
e_error 1
e_warning 2
E_notice 8
Report All errors: error_reporting (E_all);
except NOTICE, others are reported: Error_reporting (E_all & ~e_notice);
in development, the error level is higher, on-line products, the error level is low: +
define (' DEBUG ', true);//At development time, declare a DEBUG mode if (Defined (' Debug ')} {//Detect in Development mode Error_reporting (E_all); } else {error_reporting (0); }