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安全配置
Oct 09 PHP
编写PHP的安全策略
Oct 09 PHP
多重?l件?合查?(一)
Oct 09 PHP
PHP获取163、gmail、126等邮箱联系人地址【已测试2009.10.10】
Oct 11 PHP
把1316这个数表示成两个数的和,其中一个为13的倍数,另一个是11的倍数,求这两个数。
Jun 24 PHP
php 模拟get_headers函数的代码示例
Apr 27 PHP
PHP 如何利用phpexcel导入数据库
Aug 24 PHP
php类中的各种拦截器用法分析
Nov 03 PHP
浅谈COOKIE和SESSION区别
Jul 19 PHP
PHP检测用户是否关闭浏览器的方法
Feb 14 PHP
redirect_uri参数错误的解决方法(必看)
Feb 16 PHP
PHP7 弃用功能
Mar 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
轻松入门: 煮好咖啡的七个诀窍
2021/03/03 冲泡冲煮
PHP使用range协议实现输出文件断点续传代码实例
2014/07/04 PHP
php文件上传类完整实例
2016/05/14 PHP
PHP levenshtein()函数用法讲解
2019/03/08 PHP
特殊字符、常规符号及其代码对照表
2006/06/26 Javascript
google地图的路线实现代码
2009/08/20 Javascript
js下用eval生成JSON对象
2010/09/17 Javascript
javascript 折半查找字符在数组中的位置(有序列表)
2010/12/09 Javascript
jQuery阻止同类型事件小结
2013/04/19 Javascript
分享十五款 jQuery 社交网络分享插件
2015/05/16 Javascript
js实现精确到秒的日期选择器完整实例
2016/04/30 Javascript
jQuery实现下拉框功能实例代码
2016/05/06 Javascript
JS递归遍历对象获得Value值方法技巧
2016/06/14 Javascript
javascript实现计算指定范围内的质数示例
2018/12/29 Javascript
JS高阶函数原理与用法实例分析
2019/01/15 Javascript
layui默认选中table的CheckBox复选框方法
2019/09/19 Javascript
axios实现文件上传并获取进度
2020/03/25 Javascript
详解微信小程序中var、let、const用法与区别
2020/01/11 Javascript
python实现list元素按关键字相加减的方法示例
2017/06/09 Python
python 对dataframe下面的值进行大规模赋值方法
2018/06/09 Python
python一键去抖音视频水印工具
2018/09/14 Python
30行Python代码实现高分辨率图像导航的方法
2020/05/22 Python
Python 如何测试文件是否存在
2020/07/31 Python
浅谈对python中if、elif、else的误解
2020/08/20 Python
selenium+python实现基本自动化测试的示例代码
2021/01/27 Python
英国最大的体育&时尚零售公司:JD Sports
2017/12/13 全球购物
怎样声明接口
2014/09/19 面试题
房地产销售计划书
2014/01/10 职场文书
缅怀先烈演讲稿
2014/09/03 职场文书
领导党的群众路线教育实践活动个人对照检查材料
2014/09/23 职场文书
关于对大人不礼貌的检讨书
2014/09/29 职场文书
2014年质量管理工作总结
2014/12/01 职场文书
2017新年晚会开幕词
2016/03/03 职场文书
优秀范文:《但愿人长久》教学反思3篇
2019/10/24 职场文书
2021-4-3课程——SQL Server查询【2】
2021/04/05 SQL Server
python3美化表格数据输出结果的实现代码
2021/04/14 Python