Home >Backend Development >PHP Tutorial >php Notice : Use of undefined constant solution_PHP tutorial

php Notice : Use of undefined constant solution_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:55:441212browse

When I was doing php, I suddenly got the error php Notice: Use of undefined constant. One is that the variable is not defined. Let’s take a look at the solution.

Error message

php Notice : Use of undefined constant

Analysis

These are PHP prompts rather than errors. PHP itself can be used directly without declaring variables in advance, but there will be prompts for undeclared variables. Generally, as an official website, prompts will be turned off, and even error messages will be turned off

Solution

How to turn off PHP prompts

Search php.ini:

 

You need to change your php.ini file
The code is as follows
 代码如下 复制代码

error_reporting = E_ALL

  改为:

  error_reporting = E_ALL & ~E_NOTICE

Copy code

error_reporting = E_ALL

Changed to:

 代码如下 复制代码
 error_reporting(0); 虽然不好弄但是可以解决问题
 error_reporting = E_ALL & ~E_NOTICE



Another alternative is

Add

to the header of each file

 代码如下 复制代码

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

Foreign reference articles

Hello,
find the word "error_reporting" in your php.ini file and make the

change like below..

The code is as follows Copy code
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT regards R.Sureshkannan
http://www.bkjia.com/PHPjc/632226.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632226.htmlTechArticleWhen I was doing php, an error like php Notice: Use of undefined constant suddenly appeared. One is that the variable is not defined. problem, let’s take a look at the solution. Error message php No...
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