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 str_replace的替换漏洞
Mar 15 PHP
关于PHP session 存储方式的详细介绍
Jun 25 PHP
PHP文件去掉PHP注释空格的函数分析(PHP代码压缩)
Jul 02 PHP
php mysql_real_escape_string函数用法与实例教程
Sep 30 PHP
destoon实现VIP排名一直在前面排序的方法
Aug 21 PHP
php格式化电话号码的方法
Apr 24 PHP
PHP cURL初始化和执行方法入门级代码
May 28 PHP
LINUX下PHP程序实现WORD文件转化为PDF文件的方法
May 13 PHP
thinkphp的dump函数无输出实例代码
Nov 15 PHP
thinkPHP5实现的查询数据库并返回json数据实例
Oct 23 PHP
PHP一个简单的无需刷新爬虫
Jan 05 PHP
PHP实现笛卡尔积算法的实例讲解
Dec 22 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安装问题
2006/10/09 PHP
利用curl 多线程 模拟 并发的详解
2013/06/14 PHP
php操作redis中的hash和zset类型数据的方法和代码例子
2014/07/05 PHP
javascript下查找父节点的简单方法
2007/08/13 Javascript
javascript 兼容FF的onmouseenter和onmouseleave的代码
2008/07/19 Javascript
一个简单的JavaScript 日期计算算法
2009/09/11 Javascript
jQuery EasyUI API 中文文档 - EasyLoader 加载器
2011/09/29 Javascript
Ext JS 4实现带week(星期)的日期选择控件(实战一)
2013/08/21 Javascript
JS小功能(操作Table--动态添加删除表格及数据)实现代码
2013/11/28 Javascript
原生JS实现风箱式demo,并封装了一个运动框架(实例代码)
2016/07/22 Javascript
JS获取input file绝对路径的方法(推荐)
2016/08/02 Javascript
XMLHttpRequest Level 2 使用指南
2016/08/26 Javascript
js注入 黑客之路必备!
2016/09/14 Javascript
jQuery控制控件文本的长度的操作方法
2016/12/05 Javascript
微信小程序 图片宽度自适应的实现
2017/04/06 Javascript
Vue键盘事件用法总结
2017/04/18 Javascript
关于Angular2 + node接口调试的解决方案
2017/05/28 Javascript
angularjs实现搜索的关键字在正文中高亮出来
2017/06/13 Javascript
详解关于微信setData回调函数中的坑
2019/02/18 Javascript
详解vue中axios的使用与封装
2019/03/20 Javascript
微信域名检测接口调用演示步骤(含PHP、Python)
2019/12/08 Javascript
[02:43]2018DOTA2亚洲邀请赛主赛事首日TOP5
2018/04/04 DOTA
在Django中使用Sitemap的方法讲解
2015/07/22 Python
轻量级的Web框架Flask 中模块化应用的实现
2017/09/11 Python
matplotlib subplots 调整子图间矩的实例
2018/05/25 Python
flask框架使用orm连接数据库的方法示例
2018/07/16 Python
印度尼西亚在线时尚购物网站:ZALORA印尼
2016/08/02 全球购物
德国传统玻璃制造商:Cristalica
2018/04/23 全球购物
企业车辆管理制度
2014/01/24 职场文书
普通简短的个人自我评价
2014/02/15 职场文书
数字化校园建设方案
2014/05/03 职场文书
领导班子在批评与自我批评座谈会上的发言
2014/09/28 职场文书
公安领导班子四风问题个人整改措施思想汇报
2014/10/09 职场文书
心得体会格式及范文
2016/01/25 职场文书
比较几种Redis集群方案
2021/06/21 Redis
Vue图片裁剪组件实例代码
2021/07/02 Vue.js