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验证码类代码( 最新修改,完全定制化! )
Dec 02 PHP
php压缩多个CSS为一个css的代码并缓存
Apr 21 PHP
深入解析php之apc
May 15 PHP
PHP数组排序函数合集 以及它们之间的联系分析
Jun 27 PHP
php获取指定日期之间的各个周和月的起止时间
Nov 24 PHP
php中PDO方式实现数据库的增删改查
May 17 PHP
PHP通过串口实现发送短信
Jul 08 PHP
在PHP中使用FastCGI解析漏洞及修复方案
Nov 10 PHP
PHP线程的内存回收问题
Jul 08 PHP
Laravel 5.3 学习笔记之 错误&日志
Aug 28 PHP
PHP-X系列教程之内置函数的使用示例
Oct 16 PHP
PHP分享图片的生成方法
Apr 25 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
thinkphp5.1 文件引入路径问题及注意事项
2018/06/13 PHP
原生PHP实现导出csv格式Excel文件的方法示例【附源码下载】
2019/03/07 PHP
JS获取dom 对象 ajax操作 读写cookie函数
2009/11/18 Javascript
不使用中间变量,交换int型的 a, b两个变量的值。
2010/10/29 Javascript
jQuery 源码分析笔记(6) jQuery.data
2011/06/08 Javascript
JavaScript 大数据相加的问题
2011/08/03 Javascript
js 判断计算字符串长度/判断空的简单方法
2013/08/05 Javascript
基于javascript的COOkie的操作实现只能点一次
2014/12/26 Javascript
深入浅出分析javaScript中this用法
2015/05/09 Javascript
jQuery实现自动滚动到页面顶端的方法
2015/05/22 Javascript
javascript中错误使用var造成undefined
2016/03/31 Javascript
jQuery mobile在页面加载时添加加载中效果 document.ready 和window.onload执行顺序比较
2016/07/14 Javascript
Bootstrap模态框插件使用详解
2017/05/11 Javascript
jQuery Layer弹出层传值到父页面的实现代码
2017/08/17 jQuery
JavaScript实现离开页面前提示功能【附jQuery实现方法】
2017/09/26 jQuery
JS实现元素上下左右移动效果
2017/10/18 Javascript
Angular学习笔记之集成三方UI框架、控件的示例
2018/03/23 Javascript
vue短信验证性能优化如何写入localstorage中
2018/04/25 Javascript
jquery.tagsinput.js实现记录checkbox勾选的顺序
2019/09/21 jQuery
JS实现随机抽选获奖者
2019/11/07 Javascript
微信小程序完美解决scroll-view高度自适应问题的方法
2020/08/08 Javascript
Vue如何将页面导出成PDF文件
2020/08/17 Javascript
Vue基于localStorage存储信息代码实例
2020/11/16 Javascript
Django的信号机制详解
2017/05/05 Python
python实现搜索文本文件内容脚本
2018/06/22 Python
jupyter notebook 使用过程中python莫名崩溃的原因及解决方式
2020/04/10 Python
Python2手动安装更新pip过程实例解析
2020/07/16 Python
python time.strptime格式化实例详解
2021/02/03 Python
基于HTML5 Canvas 实现弹出框效果
2017/06/05 HTML / CSS
详解如何解决canvas图片getImageData,toDataURL跨域问题
2018/09/17 HTML / CSS
园林设计师自荐信
2013/11/18 职场文书
面试后感谢信怎么写
2014/02/01 职场文书
企业贷款委托书格式
2014/09/12 职场文书
总结Python连接CS2000的详细步骤
2021/06/23 Python
SpringBoot工程下使用OpenFeign的坑及解决
2021/07/02 Java/Android
Python卷积神经网络图片分类框架详解分析
2021/11/07 Python