Home > Article > Backend Development > How to disable error reporting in php
How to disable error reporting in php: First open the php.ini configuration file; then find "display_errors="; finally change the value after "=" to "off". You can also add "error_reporting(0)" to the php script to block all error prompts.
Shield PHP error prompt
(Recommended tutorial: php graphic tutorial)
Method One: Add @ before the function that may go wrong, and then or die ("").
For example:
@mysql_connect(...) or die("Database Connect Error")
Method 2: Edit the php.ini configuration file, search for "display_errors =" , and change the value after "=" to "off".
(Video tutorial recommendation: php video tutorial)
Method 3: Add error_reporting(0) before the php script to block all error prompts.
The error_reporting() function specifies which error to report. This function sets the error reporting level of the current script and returns the old error reporting level.
Grammar:
error_reporting(report_level)
The above is the detailed content of How to disable error reporting in php. For more information, please follow other related articles on the PHP Chinese website!