Home >Backend Development >PHP Problem >How to turn off notice level error prompts in php?

How to turn off notice level error prompts in php?

青灯夜游
青灯夜游Original
2020-11-05 11:22:442807browse

Close method: 1. In the php.ini file, change the value of the "error_reporting" item to "E_ALL & ~E_NOTICE"; 2. Add "error_reporting(E_ALL^) to the page where notice prompts need to be disabled. E_NOTICE);" code.

How to turn off notice level error prompts in php?

Recommended: "PHP Video Tutorial"

PHP's Notice error message level is not fatal, even if it occurs Wrong, the script will not stop running, so how to turn off the notice-level error prompt? The following article will introduce it to you.

Notice is caused by using an undefined variable or array index; for example, accessing an undefined variable or array index.

How to turn off notice level error prompts in php?

How to turn off notice level error prompts in php?

php closes notice-level error prompts

Method 1. Modification php.ini configuration file

Change error_reporting

in the php.ini file to:

error_reporting = E_ALL & ~E_NOTICE

Method 2. Use error_reporting in the PHP file () function

If you cannot operate the php.ini file, you can use the following method

Add the following code to the page where you want to disable notice error prompts:

error_reporting(E_ALL^E_NOTICE);

or

error_reporting(0);

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

The above is the detailed content of How to turn off notice level error prompts 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