When PHP is running, it gives different hints for errors of varying severity.
Eg: when $a is not declared, it is added directly, the value is null, and when added, it is counted as 0来. However, it prompts notice, that is, attention.
We are in the development, in order to the standardization of the procedure, the error level, the higher notice level of the report, help us to quickly locate errors and code specifications, but, in the product online, website OperationIn the process, it is not appropriate to report so many mistakes.
1: This error gives the customer a bad impression
2: In the error, the site's absolute path, such as D:\www\1015 are reported out. Increase the risk of being attacked
Therefore, after the website is on-line, should let the error level reduce, the small error even does not report.
To Modify the error level:
Modify error_reporting option in 1:php.ini
2: Can be in the PHP page, with the error_reporting () function to modify
The error level is represented by a value of 2:1111 1111 1111 111 from left to right, 1 per digit, representing an error level
Fatal error fatal errors: 0000 0000 0000 001 Open 1
Warning warning error: 0000 0000 0000 010 Open 2
NOTICE warning: 0000 0000 0001 000 Open 8
eg
It's all in the papers.: error_reporting (11);
don't report notice .: error_reporting (3);
No mistakes are reported .: error_reporting (0);
The system replaces the values of each level with the system constants.
E_error 1
E_warning 2
E_notice 8
Report All errors: error_reporting (E_all);
In addition to NOTICE, others are reported: Error_reporting (E_all & ~e_notice);
In the development, the error level is higher, in the on-line product, the error level should be low: +
Copy Code code as follows:
Define (' DEBUG ', true); At development time, declare a debug mode
if (defined (' DEBUG ')) {//detected in development mode
Error_reporting (E_all);
} else {
error_reporting (0);
}