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函数解决SQL injection
Oct 09 PHP
php仿discuz分页效果代码
Oct 02 PHP
PHP下利用shell后台运行PHP脚本,并获取该脚本的Process ID的代码
Sep 19 PHP
php中将数组转成字符串并保存到数据库中的函数代码
Sep 29 PHP
50个PHP程序性能优化的方法
Jun 02 PHP
ThinkPHP CURD方法之data方法详解
Jun 18 PHP
CodeIgniter分页类pagination使用方法示例
Mar 28 PHP
PHP实现可自定义样式的分页类
Mar 29 PHP
php 输出json及显示json中的中文汉字详解及实例
Nov 09 PHP
php中简单的对称加密算法实现
Jan 05 PHP
2020最新版 PhpStudy V8.1版本下载安装使用详解
Oct 30 PHP
详解Laravel框架的依赖注入功能
May 27 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
Youku 视频绝对地址获取的方法详解
2013/06/26 PHP
zend Framework中的Layout(模块化得布局)详解
2013/06/28 PHP
php实现求相对时间函数
2015/06/15 PHP
yum命令安装php7和相关扩展
2016/07/04 PHP
PHP获取页面执行时间的方法(推荐)
2016/12/10 PHP
JS面向对象、prototype、call()、apply()
2009/05/14 Javascript
JS学习之一个简易的日历控件
2010/03/24 Javascript
javascript 冒泡排序 正序和倒序实现代码
2010/12/14 Javascript
js隐藏与显示回到顶部按钮及window.onscroll事件应用
2013/01/25 Javascript
js弹出层永远居中实现思路及代码
2013/11/29 Javascript
跟我学习javascript的this关键字
2020/05/28 Javascript
jQuery Validate表单验证深入学习
2015/12/18 Javascript
基于jQuery实现歌词滚动版音乐播放器的代码
2016/09/17 Javascript
jQuery插件ContextMenu自定义图标
2017/03/15 Javascript
在一个页面实现两个zTree联动的方法
2017/12/20 Javascript
python学习教程之Numpy和Pandas的使用
2017/09/11 Python
今天 平安夜 Python 送你一顶圣诞帽 @微信官方
2017/12/25 Python
python 使用 requests 模块发送http请求 的方法
2018/12/09 Python
Python3.5文件修改操作实例分析
2019/05/01 Python
python 实现屏幕录制示例
2019/12/23 Python
matlab灰度图像调整及imadjust函数的用法详解
2020/02/27 Python
python不到50行代码完成了多张excel合并的实现示例
2020/05/28 Python
python Tornado框架的使用示例
2020/10/19 Python
澳大利亚牛仔裤商店:Just Jeans
2016/10/13 全球购物
NOTINO英国:在线购买美容和香水
2020/02/25 全球购物
几道Java和数据库的面试题
2013/05/30 面试题
亲子拓展活动方案
2014/02/20 职场文书
汉语言文学专业求职信
2014/06/19 职场文书
2014年党员个人工作总结
2014/12/02 职场文书
2015党建工作简报
2015/07/21 职场文书
2016年秋季运动会通讯稿
2015/11/25 职场文书
2016年记者节感言
2015/12/08 职场文书
python实现socket简单通信的示例代码
2021/04/13 Python
golang正则之命名分组方式
2021/04/25 Golang
Java用自带的Image IO给图片添加水印
2021/06/15 Java/Android
MySQL使用IF语句及用case语句对条件并结果进行判断 
2022/09/23 MySQL