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生成静态页面分析 模板+缓存+写文件
Aug 17 PHP
PHP 图片上传代码
Sep 13 PHP
php中通过正则表达式下载内容中的远程图片的函数代码
Jan 10 PHP
php 去除html标记--strip_tags与htmlspecialchars的区别详解
Jun 26 PHP
PHP中使用file_get_contents post数据代码例子
Feb 13 PHP
php动态添加url查询参数的方法
Apr 14 PHP
PHP模拟QQ登录的方法
Jul 29 PHP
php入门教程之Zend Studio设置与开发实例
Sep 09 PHP
谈谈从phpinfo中能获取哪些值得注意的信息
Mar 28 PHP
使用Laravel中的查询构造器实现增删改查功能
Sep 03 PHP
php实现推荐功能的简单实例
Sep 29 PHP
PHP pthreads v3下worker和pool的使用方法示例
Feb 21 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
ecshop 订单确认中显示省市地址信息的方法
2010/03/15 PHP
在yii中新增一个用户验证的方法详解
2013/06/20 PHP
php中使用Ajax时出现Error(c00ce56e)的详细解决方案
2014/11/03 PHP
PHP判断来访是搜索引擎蜘蛛还是普通用户的代码小结
2015/09/14 PHP
php实现评论回复删除功能
2017/05/23 PHP
通过修改Laravel Auth使用salt和password进行认证用户详解
2017/08/17 PHP
Yii框架视图、视图布局、视图数据块操作示例
2019/10/14 PHP
jQuery 工具函数学习资料
2010/04/29 Javascript
jquery异步请求实例代码
2011/06/21 Javascript
js完美的div拖拽实例代码
2014/01/22 Javascript
jQuery如何将选中的对象转化为原始的DOM对象
2014/06/09 Javascript
javascript的日期对象、数组对象、二维数组使用说明
2014/12/22 Javascript
JS中定位 position 的使用实例代码
2017/08/06 Javascript
Vue在页面右上角实现可悬浮/隐藏的系统菜单
2018/05/04 Javascript
mac上配置Android环境变量的方法
2018/07/08 Javascript
JavaScript实现栈结构Stack过程详解
2020/03/07 Javascript
Map与WeakMap类型在JavaScript中的使用详解
2020/11/18 Javascript
Python入门篇之列表和元组
2014/10/17 Python
win10系统中安装scrapy-1.1
2016/07/03 Python
用Eclipse写python程序
2018/02/10 Python
python实现拓扑排序的基本教程
2018/03/11 Python
在pycharm下设置自己的个性模版方法
2019/07/15 Python
基于python实现自动化办公学习笔记(CSV、word、Excel、PPT)
2019/08/06 Python
CSS3中的元素过渡属性transition示例详解
2016/11/30 HTML / CSS
美国钻石商店:Zales
2016/11/20 全球购物
西班牙香水和化妆品网上商店:Douglas
2017/10/29 全球购物
校园文明倡议书
2014/05/16 职场文书
公共场所禁烟标语
2014/06/25 职场文书
研究生简历自我评价范文
2014/09/13 职场文书
家庭贫困证明范本(经典版)
2014/09/22 职场文书
导师对论文的学术评语
2015/01/04 职场文书
傲慢与偏见电影观后感
2015/06/10 职场文书
党员心得体会范文2016
2016/01/23 职场文书
民事调解协议书
2016/03/21 职场文书
Pytorch中的数据集划分&正则化方法
2021/05/27 Python
python实现对doc、txt、xls等文档的读写操作
2022/04/02 Python