For details about how to disable the PHP error message. The simplest way is to directly add the following code to the php program code: Copy the code as follows: error_reporting (E_ALL ^ E_NOTICE ^ E_WARNING ); the simplest way to disable all notice and warning levels is to directly add the following code to the php program code:
The code is as follows:
Error_reporting (E_ALL ^ E_NOTICE ^ E_WARNING );
Disable all notice and warning errors.
Put this statement in the function inclusion file of your script, which is usually controlled by config. php or conn. php.
Of course, I can also set it in php. ini as follows:
Open the PHP. ini file in the php installation directory.
Find display_errors = On and change it to display_errors = off.
Note: If you have copied the PHP. ini file to the windows directory, you must change display_errors = On in c: windows/php. ini to display_errors = off.
Solution for failure of display_errors = Off in PHP. ini
Problem:
In the PHP setting file php. ini, display_errors = Off is already set, but an error message still appears on the webpage during running.
Solution:
Open the PHP. ini file in the php installation directory.
Find log_errors = off and change it to log_errors = on.
Find error_log = filename and change it to error_log = "D: PHPerrlogphp_error.log" (here, the directory and file name D: PHPerrlogphp_error.log are whatever you want)
Note: If you have copied the PHP. ini file to the windows directory, you must also copy the c: windows/php. ini file.
In addition, php_error.log must have at least the USER's modification and write permissions. Otherwise, the error log cannot be output.
Often seen error_reporting (7) meaning: Set the error message return level.
Value constant
1 E_ERROR
2 E_WARNING
4 E_PARSE
8 E_NOTICE
16 E_CORE_ERROR
32 E_CORE_WARNING
64 E_COMPILE_ERROR
128 E_COMPILE_WARNING
256 E_USER_ERROR
512 E_USER_WARNING
1024 E_USER_NOTICE
2047 E_ALL
2048 E_STRICT
However, 7 = 1 + 2 + 4
1 E_ERROR 2 E_WARNING 4 E_PARSE is displayed when an error occurs.
The code is as follows:
// Disable error reporting
Error_reporting (0 );
// Report running errors
Error_reporting (E_ERROR | E_WARNING | E_PARSE );
// Report all errors
Error_reporting (E_ALL );
?>
The warning code is as follows: error_reporting (E_ALL ^ E_NOTICE ^ E_WARNING); you can disable all notice and warning levels...