PHP运行出现Notice : Use of undefined constant 的完美解决方案分享


Posted in PHP onMarch 05, 2012

Notice: Use of undefined constant ALL_PS - assumed 'ALL_PS' in E:\Server\vhosts\www.lvtao.net\global.php on line 50

Notice: Undefined index: EaseTemplateVer in E:\Server\vhosts\www.lvtao.net\libs\template.core.php on line 51

Notice: Use of undefined constant uid - assumed 'uid' in E:\Server\vhosts\www.lvtao.net\global.php on line 54

Notice: Undefined index: uid in E:\Server\vhosts\www.lvtao.net\global.php on line 54

Notice: Use of undefined constant cuid - assumed 'cuid' in E:\Server\vhosts\www.lvtao.net\global.php on line 55

Notice: Undefined index: cuid in E:\Server\vhosts\www.lvtao.net\global.php on line 55

Notice: Use of undefined constant shell - assumed 'shell' in E:\Server\vhosts\www.lvtao.net\global.php on line 56

Notice: Undefined index: shell in E:\Server\vhosts\www.lvtao.net\global.php on line 56

Notice: Use of undefined constant cshell - assumed 'cshell' in E:\Server\vhosts\www.lvtao.net\global.php on line 57

Notice: Undefined index: cshell in E:\Server\vhosts\www.lvtao.net\global.php on line 57

Notice: Use of undefined constant username - assumed 'username' in E:\Server\vhosts\www.lvtao.net\global.php on line 58

Notice: Undefined index: username in E:\Server\vhosts\www.lvtao.net\global.php on line 58

Notice: Use of undefined constant cusername - assumed 'cusername' in E:\Server\vhosts\www.lvtao.net\global.php on line 59

Notice: Undefined index: cusername in E:\Server\vhosts\www.lvtao.net\global.php on line 59

Notice: Use of undefined constant id - assumed 'id' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 10

Notice: Use of undefined constant id - assumed 'id' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 14

Notice: Use of undefined constant content - assumed 'content' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 16

Notice: Use of undefined constant content - assumed 'content' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 16

Notice: Use of undefined constant description - assumed 'description' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 17

Notice: Use of undefined constant description - assumed 'description' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 17

Notice: Use of undefined constant provinceid - assumed 'provinceid' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 18

Notice: Use of undefined constant cityid - assumed 'cityid' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 19

Notice: Use of undefined constant hy - assumed 'hy' in E:\Server\vhosts\www.lvtao.net\companyjob.php on line 20

Notice: Undefined variable: content in E:\Server\vhosts\www.lvtao.net\libs\template.core.php on line 557

进入网站会出现大量类似下面的提示,但是可以正常显示和运行

Notice: Use of undefined constant ctbTitle - assumed 'ctbTitle' in d:\ctb1.5\ctb\include\config.php on line 23...

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

关闭 PHP 提示的方法

搜索php.ini:

error_reporting = E_ALL

改为:

error_reporting = E_ALL & ~E_NOTICE

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

在每个文件头上加

error_reporting(0); 虽然不好弄但是可以解决问题!!!!!!这个比较好用

PHP 相关文章推荐
php时间不正确的解决方法
Apr 09 PHP
PHP程序员编程注意事项
Apr 10 PHP
用PHP实现读取和编写XML DOM代码
Apr 07 PHP
php学习笔记之 函数声明(二)
Jun 09 PHP
PHP不用第三变量交换2个变量的值的解决方法
Jun 02 PHP
PHP获取网页标题的3种实现方法代码实例
Apr 11 PHP
windwos下使用php连接oracle数据库的过程分享
May 26 PHP
PHP对文件夹递归执行chmod命令的方法
Jun 19 PHP
PHP面向对象程序设计之类与反射API详解
Dec 02 PHP
php批量修改表结构实例
May 24 PHP
php基于环形链表解决约瑟夫环问题示例
Nov 07 PHP
PHP正则表达式处理函数(PCRE 函数)实例小结
May 09 PHP
php在服务器执行exec命令失败的解决方法
Mar 03 #PHP
Php Ctemplate引擎开发相关内容
Mar 03 #PHP
PHP代码网站如何防范SQL注入漏洞攻击建议分享
Mar 01 #PHP
PHP和JAVA中的重载(overload)和覆盖(override) 介绍
Mar 01 #PHP
JS中encodeURIComponent函数用php解码的代码
Mar 01 #PHP
PHP设计模式之装饰者模式
Feb 29 #PHP
php preg_filter执行一个正则表达式搜索和替换
Feb 27 #PHP
You might like
PHP中几个常用的魔术常量
2012/02/23 PHP
Laravel的throttle中间件失效问题解决方法
2016/10/09 PHP
PHP实现的基于单向链表解决约瑟夫环问题示例
2017/09/30 PHP
php微信开发之谷歌测距
2018/06/14 PHP
js禁止页面刷新禁止用F5键刷新禁止右键的示例代码
2013/09/23 Javascript
jquery实现仿Flash的横向滑动菜单效果代码
2015/09/17 Javascript
NodeJS处理Express中异步错误
2017/03/26 NodeJs
jQuery validata插件实现方法
2017/06/25 jQuery
vue仿淘宝订单状态的tab切换效果
2020/06/23 Javascript
vue 点击按钮实现动态挂载子组件的方法
2018/09/07 Javascript
Vuex 单状态库与多模块状态库详解
2018/12/11 Javascript
Vuerouter的beforeEach与afterEach钩子函数的区别
2018/12/26 Javascript
element-ui带输入建议的input框踩坑(输入建议空白以及会闪出上一次的输入建议问题)
2019/01/15 Javascript
Vue包大小优化的实现(从1.72M到94K)
2021/02/18 Vue.js
Python文件夹与文件的操作实现代码
2014/07/13 Python
1分钟快速生成用于网页内容提取的xslt
2018/02/23 Python
django数据关系一对多、多对多模型、自关联的建立
2019/07/24 Python
Python 2种方法求某个范围内的所有素数(质数)
2020/01/31 Python
python实现遍历文件夹图片并重命名
2020/03/23 Python
Django-Scrapy生成后端json接口的方法示例
2020/10/06 Python
Python调用Redis的示例代码
2020/11/24 Python
HTML5开发动态音频图的实现
2020/07/02 HTML / CSS
微软马来西亚官方网站:Microsoft马来西亚
2019/11/22 全球购物
What is the purpose of Void class? Void类的作用是什么?
2016/10/31 面试题
介绍一下.net和Java的特点和区别
2012/09/26 面试题
初中生个人学习的自我评价
2013/12/04 职场文书
自我鉴定三原则
2014/01/13 职场文书
高三毕业寄语
2014/04/10 职场文书
幼儿园爱国卫生月活动总结
2014/06/30 职场文书
领导干部作风建设自查报告
2014/10/23 职场文书
婚礼庆典答谢词
2015/01/20 职场文书
高中生综合素质自我评价
2015/03/06 职场文书
道歉的话语大全
2015/05/12 职场文书
Mac环境Nginx配置和访问本地静态资源的实现
2021/03/31 Servers
Redis分布式锁的7种实现
2022/04/01 Redis
使用Ajax实现无刷新上传文件
2022/04/12 Javascript