Home > Article > Backend Development > How many ways are there to close the page error message in PHP?
#How many ways are there to close the page error message in PHP?
The ways for PHP to close the error prompts on the page are:
1. You can close all notice
and warning
level error.
Put this statement in the function include file of your script, usually config.php or conn.php to control the output. Of course, you can also set
in php.ini. The method is as follows:
1. Open the php.ini file in the PHP installation directory
2. Find display_errors=On
Change to display_errors=off
Note: If you have copied the PHP.ini file to the windows directory, you must also copy c:windows
display_errors = On in /php.ini
is changed to
display_errors=off
<br>
Problem:
PHP setting file php .ini
has clearly been set display_errors=Off
, but during operation, there will still be a message on the web page An error message appears.
Solution:
1. Open the php.ini file in the PHP installation directory
2. Find log_errors=off
and change it to log_errors =on
3. Find error_log=filename
and change it to error_log="D:PHPerrlogphp_error.log"
(the directory and file name here are D:PHPerrlogphp_error .log (whatever you want)<br><br>
Note:
If you have copied the PHP.ini file to the windows directory, you must also needc: windows/php.ini
file.
In additionphp_error.log
Must have at least USER's modification and write permissions, otherwise the error log cannot be output.<br> <br>Frequently seenerror_reporting(7)
Straight meaning: Set the level of error message reporting.
However, 7=1 2 4<br> is displayed when an error occurs
1 E_ERROR 2 E_WARNING 4 E_PARSE
The code is as follows:
<?php //禁用错误报告 error_reporting(0); //报告运行时错误 error_reporting(E_ERROR | E_WARNING | E_PARSE); //报告所有错误 error_reporting(E_ALL); ?>
2. The easiest way is to add the following code directly to the php program code: <br>The code is as follows:<br>
error_reporting(E_ALL^E_NOTICE^E_WARNING);
<br><br>
The above is the detailed content of How many ways are there to close the page error message in PHP?. For more information, please follow other related articles on the PHP Chinese website!