How to turn off notice level error prompts in php?

青灯夜游
Release: 2023-03-07 10:52:01
Original
2697 people have browsed it

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

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

or

error_reporting(0);
Copy after login

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!

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!