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

How to disable error reporting in php

王林
Release: 2023-03-03 20:24:01
Original
4495 people have browsed it

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")
Copy after login

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)
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template