Home >Backend Development >PHP Problem >How to disable error reporting in php

How to disable error reporting in php

王林
王林Original
2020-08-05 13:55:364503browse

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.

How to disable error reporting in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn