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&&mysql)一
Oct 09 PHP
php目录管理函数小结
Sep 10 PHP
PHP 抓取新浪读书频道的小说并生成txt电子书的代码
Dec 18 PHP
php数据库抽象层 PDO
May 07 PHP
php数组中删除元素的实现代码
Jun 22 PHP
php CI框架插入一条或多条sql记录示例
Jul 29 PHP
PHP使用递归方式列出当前目录下所有文件的方法
Jun 02 PHP
PHP实现XML与数据格式进行转换类实例
Jul 29 PHP
WordPres对前端页面调试时的两个PHP函数使用小技巧
Dec 22 PHP
PHP substr()函数参数解释及用法讲解
Nov 23 PHP
PHP封装的完整分页类示例
Aug 21 PHP
mac pecl 安装php7.1扩展教程
Oct 17 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
APACHE的AcceptPathInfo指令使用介绍
2013/01/18 PHP
php实现可以设置中奖概率的抽奖程序代码分享
2014/01/19 PHP
PHP PDO fetch 模式各种参数的输出结果一览
2015/01/07 PHP
PHP缓冲区用法总结
2016/02/14 PHP
基于php中echo用逗号和用点号的区别详解
2018/01/23 PHP
PHP实现时间日期友好显示实现代码
2019/09/08 PHP
PHP二维数组分页2种实现方法解析
2020/07/09 PHP
简洁短小的 JavaScript IE 浏览器判定代码
2010/03/21 Javascript
理解Javascript_08_函数对象
2010/10/15 Javascript
js函数在frame中的相互调用详解
2014/03/03 Javascript
javascript去除字符串中所有标点符号和提取纯文本的正则
2014/06/07 Javascript
了解Javascript的模块化开发
2015/03/02 Javascript
JQUERY简单按钮轮换选中效果实现方法
2015/05/07 Javascript
jQuery实现径向动画菜单效果
2015/07/17 Javascript
使用OpenLayers3 添加地图鼠标右键菜单
2015/12/29 Javascript
元素全屏的设置与监听实例
2017/11/28 Javascript
BootStrap自定义popover,点击区域隐藏功能的实现
2018/01/23 Javascript
element-ui 关于获取select 的label值方法
2018/08/24 Javascript
WebStorm中如何将自己的代码上传到github示例详解
2020/10/28 Javascript
Python中动态检测编码chardet的使用教程
2017/07/06 Python
python多线程http压力测试脚本
2019/06/25 Python
Python正则表达式匹配数字和小数的方法
2019/07/03 Python
django-crontab 定时执行任务方法的实现
2019/09/06 Python
利用PyCharm操作Github(仓库新建、更新,代码回滚)
2019/12/18 Python
python框架flask入门之路由及简单实现方法
2020/06/07 Python
tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this T
2020/06/22 Python
python实现简单遗传算法
2020/09/18 Python
Scrapy中如何向Spider传入参数的方法实现
2020/09/28 Python
美国电视购物HSN官网:HSN
2016/09/07 全球购物
eVitamins日本:在线购买折扣维生素、补品和草药
2019/04/04 全球购物
2014年中班元旦活动方案
2014/02/14 职场文书
装修施工安全责任书
2014/07/24 职场文书
竞选大队干部演讲稿
2014/09/11 职场文书
2014年班干部工作总结
2014/11/25 职场文书
师德师风学习材料
2014/12/19 职场文书
蔬果开业典礼发言稿应该怎么写?
2019/09/03 职场文书