If an error occurs when a PHP program is running, whether the error message is displayed on the browser and the level of the error message are what we need to control during program development, debugging, and operation.
The following explains how to control the shielding and display of PHP error messages (errors) by setting php.ini:
1. Whether error messages are displayed
Copy code The code is as follows:
Display errors display_errors = On
Screen errors display_errors = Off (default value)
2. Display error message level
Copy code The code is as follows:
error_reporting = E_ALL (all)
error_reporting = E_ALL & ~E_NOTICE (Notice above errors will be displayed)
Here we generally set it to E_ALL, and use the error_reporting() function in the PHP program to set the error message level of the current program.
3. Set whether to save the error log
During the operation of the program, we generally set it not to display errors, so that the running status can be recorded by saving the error log
Copy code The code is as follows:
log_errors = On (record error log)
log_errors = Off (do not record)
If you save the error log, you need to set the error log at the same time Save the file
Copy the code The code is as follows:
error_log = e:/php/logs/php_error.log
http://www.bkjia.com/PHPjc/769243.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/769243.htmlTechArticleIf an error occurs during the running of the PHP program, whether the error message is displayed on the browser, and the error message is displayed The level is what we need in the process of program development, debugging, and operation...