PHP at runtime, for different severity of errors, will give different hints.
Eg: when $ A is not declared, it is added directly, the value is null, and the sum is counted as zero. However, it prompts notice, that is, attention.
We in the development, in order to process the normative, the error level, the higher the notice level of the report, help us to quickly locate errors and code specifications, but, after the product on-line, the website operation 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. Increase the risk of attack
Therefore, after the site on-line, you should let the error level down, less error or even do not report.
To Modify the error level:
Modify the error_reporting option in 1:php.ini
2: You can use the error_reporting () function to modify the PHP page.
The 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 on 1
Warning warning error: 0000 0000 0000 010 Open 2
NOTICE warning: 0000 0000 0001 000 Open 8
eg
it's all reported.: error_reporting (11);
Don't quote notice .: error_reporting (3);
any mistakes are not 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, the others are reported: Error_reporting (E_all & ~e_notice);
In the development, the error level is higher, on-line products, the error level is low: +
Copy CodeThe code is 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);
}
http://www.bkjia.com/PHPjc/327610.html www.bkjia.com true http://www.bkjia.com/PHPjc/327610.html techarticle php at runtime, for different severity of errors, will give different hints. Eg: when $ A is not declared, it is added directly, the value is null, and the sum is counted as zero. However, it prompts notice, that is, pay attention to ...