How to cancel warning in php

藏色散人
Release: 2023-03-08 20:00:02
Original
3496 people have browsed it

php method to cancel warnings: 1. Add "ini_set("display_errors", "Off");" at the beginning of the php page; 2. Add the @ symbol before functions that may cause errors; 3. , add "error_reporting(0)" before the php script to block all error prompts.

How to cancel warning in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

php ignore the warning warning prompt, personal test 100% effective

This tutorial teaches you how to turn off the Warning warning in the php file

You may encounter warnings during the php encoding process. When it is finally put into use, if you want Turn off warnings

Method 1: Add

error_reporting(E_ERROR); 
ini_set("display_errors", "Off");
Copy after login

at the beginning of the php page There are several other methods, such as turning off all warnings

Edit php.ini , search for "display_errors =" and change the value after "=" to "off.

Method 2:

Add @ before the function that may cause errors, and then or die("" ) Such as: @mysql_connect(...) or die("Database Connect Error")

For example:

Ignore the error in the statement after @

@$a = $b['a'];
Copy after login

Ignore the error in the statement after @, it is recommended to use this sentence. Because the error occurs in the array $b, so the @ symbol can be in front of $b. This is where the error really occurs.

$a = @$b['a'];
Copy after login

Method 3:

Add error_reporting(0) before the php script to block all error prompts.

<?php
error_reporting(0)
?>
Copy after login

Recommended study: "PHP Video Tutorial"

The above is the detailed content of How to cancel warning in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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