PHP運行出現(xiàn)Notice : Use of undefined constant 的完美解決方案分享
更新時間:2012年03月05日 11:46:43 作者:
今天修改公司的網(wǎng)站,提示Notice : Use of undefined constant ,通過下面的方法解決了,最好是error_reporting(0);不需要更改配置
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
進入網(wǎng)站會出現(xiàn)大量類似下面的提示,但是可以正常顯示和運行
Notice: Use of undefined constant ctbTitle - assumed 'ctbTitle' in d:\ctb1.5\ctb\include\config.php on line 23...
b答案:這些是 PHP 的提示而非報錯,PHP 本身不需要事先聲明變量即可直接使用,但是對未聲明變量會有提示。一般作為正式的網(wǎng)站會把提示關掉的,甚至連錯誤信息也被關掉
關閉 PHP 提示的方法
搜索php.ini:
error_reporting = E_ALL
改為:
error_reporting = E_ALL & ~E_NOTICE
還有個不是辦法的辦法就是
在每個文件頭上加
error_reporting(0); 雖然不好弄但是可以解決問題?。。。。?!這個比較好用
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
進入網(wǎng)站會出現(xiàn)大量類似下面的提示,但是可以正常顯示和運行
Notice: Use of undefined constant ctbTitle - assumed 'ctbTitle' in d:\ctb1.5\ctb\include\config.php on line 23...
b答案:這些是 PHP 的提示而非報錯,PHP 本身不需要事先聲明變量即可直接使用,但是對未聲明變量會有提示。一般作為正式的網(wǎng)站會把提示關掉的,甚至連錯誤信息也被關掉
關閉 PHP 提示的方法
搜索php.ini:
error_reporting = E_ALL
改為:
error_reporting = E_ALL & ~E_NOTICE
還有個不是辦法的辦法就是
在每個文件頭上加
error_reporting(0); 雖然不好弄但是可以解決問題?。。。。?!這個比較好用
您可能感興趣的文章:
- 淺談ThinkPHP中initialize和construct的區(qū)別
- ThinkPHP中類的構造函數(shù)_construct()與_initialize()的區(qū)別詳解
- PHP正則替換函數(shù)preg_replace()報錯:Notice Use of undefined constant的解決方法分析
- php類中的$this,static,final,const,self這幾個關鍵字使用方法
- ThinkPHP中__initialize()和類的構造函數(shù)__construct()用法分析
- 解析php中static,const與define的使用區(qū)別
- php面向對象全攻略 (十) final static const關鍵字的使用
- PHP const定義常量及global定義全局常量實例解析
相關文章
最新用php獲取谷歌PR值算法,附上php查詢PR值代碼示例
用php程序怎么獲取谷歌PR值,已經(jīng)有好幾個人問我php查詢PR值怎么實現(xiàn)的,于是現(xiàn)在就把php查詢PR值法算法附上,大家可以直接使用下面的代碼去測試php查詢PR值2011-12-12php多進程并發(fā)編程防止出現(xiàn)僵尸進程的方法分析
這篇文章主要介紹了php多進程并發(fā)編程防止出現(xiàn)僵尸進程的方法,結合具體實例形式總結分析了php多進程并發(fā)編程防止出現(xiàn)僵尸進程相關操作技巧與注意事項,需要的朋友可以參考下2020-02-02PHP array_multisort()函數(shù)的使用札記
array_multisort 對多個數(shù)組或多維數(shù)組進行排序的函數(shù),需要的朋友可以參考下。2011-07-07