Home >Backend Development >PHP Problem >How to turn off warning warning in php

How to turn off warning warning in php

青灯夜游
青灯夜游Original
2021-03-09 17:26:134579browse

WARNING level warning errors are non-fatal and do not affect subsequent code execution; closing method: add "error_reporting(E_ERROR);ini_set("display_errors","Off ");" That's it.

How to turn off warning warning in php

The operating environment of this tutorial: Windows 7 system, PHP version 7.1, DELL G3 computer

warning is an error level of PHP, it is non-fatal That is, after the warning occurs, subsequent scripts can still run normally.

Example: Create a new PHP document. Since the username and password for connecting data are incorrect, a WARNING warning error will be generated

How to turn off warning warning in php

WARNING level warning errors do not affect subsequent code execution

How to turn off warning warning in php

How to turn off warning in php Warning

Add

error_reporting(E_ERROR); 
ini_set("display_errors","Off");

at the beginning of the php page [Recommended learning: "PHP Video Tutorial"]

Related function introduction:

error_reporting() function specifies which error to report. This function sets the error reporting level for the current script. This function returns the old error reporting level.

error_reporting(report_level)

Parameter introduction:

  • report_level is optional. Specifies the error reporting level for the current script. Both value numbers and constant names are accepted, however, for compatibility with future PHP versions, it is recommended to use constant names.

For more programming-related knowledge, please visit: Introduction to Programming! !

The above is the detailed content of How to turn off warning warning 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