当前位置:Gxlcms > PHP教程 > phpNotice:Useofundefinedconstant解决办法_PHP教程

phpNotice:Useofundefinedconstant解决办法_PHP教程

时间:2021-07-01 10:21:17 帮助过:3人阅读

自己在做php时突然出现php Notice : Use of undefined constant这种错误,一个就是变量未定义出问题,下面我们来看看解决办法吧。

错误提示

php Notice : Use of undefined constant

分析

这些是 PHP 的提示而非报错,PHP 本身不需要事先声明变量即可直接使用,但是对未声明变量会有提示。一般作为正式的网站会把提示关掉的,甚至连错误信息也被关掉

解决办法

  关闭 PHP 提示的方法

  搜索php.ini:

  

代码如下

error_reporting = E_ALL

  改为:

  error_reporting = E_ALL & ~E_NOTICE

  还有个不是办法的办法就是

  在每个文件头上加

 

代码如下
 error_reporting(0); 虽然不好弄但是可以解决问题

外国参考文章


Hello,
You need to change your php.ini file

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

change like below..

代码如下

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT


regards
R.Sureshkannan

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632226.htmlTechArticle自己在做php时突然出现php Notice : Use of undefined constant这种错误,一个就是变量未定义出问题,下面我们来看看解决办法吧。 错误提示 php No...

人气教程排行