美文网首页
关于PHP中变量未定义的提示

关于PHP中变量未定义的提示

作者: 卡卡西哥哥 | 来源:发表于2016-01-06 11:13 被阅读773次

在家里电脑上自己做的项目,移到外网上时出现大量如下提示:

Notice: Use of undefined constant values - assumed 'values' inD:\wamp\www\yp\index.phpon line19

Notice: Use of undefined constant values - assumed 'values' inD:\wamp\www\yp\index.phpon line19

Notice: Use of undefined constant values - assumed 'values' inD:\wamp\www\yp\index.phpon line19

Notice: Use of undefined constant values - assumed 'values' inD:\wamp\www\yp\index.phpon line19

Notice: Use of undefined constant values - assumed 'values' inD:\wamp\www\yp\index.phpon line19

Notice: Use of undefined constant values - assumed 'values' inD:\wamp\www\yp\index.phpon line19

Notice: Use of undefined constant title - assumed 'title' inD:\wamp\www\yp\index.phpon line32

Notice: Use of undefined constant id - assumed 'id' inD:\wamp\www\yp\index.phpon line32

Notice: Use of undefined constant title - assumed 'title' inD:\wamp\www\yp\index.phpon line32

Notice: Use of undefined constant id - assumed 'id' inD:\wamp\www\yp\index.phpon line32

Notice: Use of undefined constant title - assumed 'title' inD:\wamp\www\yp\index.phpon line40

猛的一看,有点懵了,本来调试的好好的,怎么会突然出现错误?

翻译了下提示的意思,才明白原来PHP中允许中变量不经过声明而直接使用,但是如果设置了error_reporting后所有错误全显示的话,就会就出现提示,所以我们在写代码时最好养成习惯,变量使用前最好先声明

解决方案自然是设置下error_reporting打开php.ini将error_reporting = E_ALL 后面加上 & ~E_NOTICE

或者在全局配置文件里写error_reporting(0)

相关文章

  • 关于PHP中变量未定义的提示

    在家里电脑上自己做的项目,移到外网上时出现大量如下提示: Notice: Use of undefined con...

  • Python学习笔记(2014.09.28)

    2014.09.28 错误提示 0,命名错误(nameError) 变量未定义或者变量名错误函数未定义或者函数名错...

  • JS学习笔记_内存泄露

    常见的四中内存泄露:1:意外的全局变量JavaScript 处理未定义变量的方式比较宽松:未定义的变量会在全局对象...

  • php变量和数据类型

    php中的变量 PHP中的变量声明 PHP中的变量的使用 PHP中的数据类型之整型 PHP数据类型之浮点类型和布尔...

  • php中的变量和常量

    php是弱类型语言,变量类型和存入的值相关 变量 php中声明一个变量用 $符 php中变量的命名规范 可变变量:...

  • 六、set的使用和数组

    set set -u 当脚本中遇到未定义的变量时,默认是忽略。有时候这并不是开发者想要的。假如有未定义的变量,应该...

  • Javascript内存泄露

    常见的js内存泄露 1. 意外的全局变量 JavaScript 处理未定义变量的方式比较宽松:未定义的变量会在全局...

  • PHP基础学习笔记1——《十天学会PHP》网易云课堂

    1、第一个PHP程序 PHP的基本格式 php行末尾都要有分号";"。注释: 2、php中的变量 php中变量以"...

  • Shell_08_set用法

    set -u 当脚本中遇到未定义的变量时,默认是忽略。 有时候这并不是开发者想要的。 假如有未定义的变量,应该报错...

  • idea thymeleaf 变量未定义

    如果使用 idea + thymeleaf 的时候,直接在模板中使用 Model 中定义的变量, 会出现变量未定义...

网友评论

      本文标题:关于PHP中变量未定义的提示

      本文链接:https://www.haomeiwen.com/subject/djpxkttx.html