首頁  >  文章  >  後端開發  >  PHP錯誤Notice : Use of undefined constant 的完美解決方法

PHP錯誤Notice : Use of undefined constant 的完美解決方法

WBOY
WBOY原創
2016-08-08 09:24:591952瀏覽

轉自:http://www.phperz.com/article/14/1212/7309.html

本文為大家講解的是PHP錯誤Notice : Use of undefined constant 的完美解決方法,這個php的非致命錯誤提醒在pph5.3以上的版本中出現的頻率非常好,主要是因為php.ini中的錯誤級別配置的問題,感興趣的同學參考下.

以上就介紹了PHP錯誤Notice : Use of undefined constant 的完美解決方法,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。

本文為大家講解的是PHP錯誤Notice : Use of undefined constant 的完美解決方法,這個php的非致命錯誤提醒在pph5.3以上的版本中出現的頻率非常好,主要是因為php.ini中的錯誤級別配置的問題,感興趣的同學參考下.

問題說明;

今天修改公司的網站,提示Notice : Use of undefined constant ,透過下面的方法解決了,最好是error_reporting(0);不需要更改配置
Notice: Use of undefined constant ALL_PS - assumed 'ALL_PS' in E:Servervhostswww.lvtao.netglobal.php on line 50
Notice: Undefined index: EaseTemplateVer in E:Servervhostswww.lvtao.netlibstemplate.core: EaseTemplateVer in E:Servervhostswww.lvtao.netlibstemplate.core.php on Notm. - assumed 'uid' in E:Servervhostswww.lvtao.netglobal.php on line 54
Notice: Undefined index: uid in E:Servervhostswww.lvtao.netglobal.php on line 54
Notice: Upse of uno. ' in E:Servervhostswww.lvtao.netglobal.php on line 55
Notice: Undefined index: cuid in E:Servervhostswww.lvtao.netglobal.php on line 55 shell
Notice: Use of undefined constant shell' Servervhostswww.lvtao.netglobal.php on line 56
Notice: Undefined index: shell in E:Servervhostswww.lvtao.netglobal.php on line 56
Notice: Use of undefined constantant cwwwsl. netglobal.php on line 57
Notice: Undefined index: cshell in E:Servervhostswww.lvtao.netglobal.php on line 57
Notice: Use of undefined constant username - assumed ' 註射. line 58
Notice: Undefined index: username in E:Servervhostswww.lvtao.netglobal.php on line 58
Notice: Use of undefined constant cusername - assumed 'cusername' in E:Server of undefined constant cusername - assumed 'cusername' in E:Serveronvg. : Undefined index: cusername in E:Servervhostswww.lvtao.netglobal.php on line 59
Notice: Use of undefined constant id - assumed 'id' in E:Servervhostswww.lvtao.netcompany 10on company 75% constant id - assumed 'id' in E:Servervhostswww.lvtao.netcompanyjob.php on line 14
Notice: Use of undefined constant content - assumed 'content' in E:Servervhostswww.lvtao.netcompanyjob. 表of undefined constant content - assumed 'content' in E:Servervhostswww.lvtao.netcompanyjob.php on line 16
Notice: Use of undefined constant description - assumed 'description' in EServervhostsNotm.como. : Use of undefined constant description - assumed 'description' in E:Servervhostswww.lvtao.netcompanyjob.php on line 17
Notice: Use of undefined constant provinceid - assumed 'provinceidany inv.S.
Notice: Use of undefined constant cityid - assumed 'cityid' in E:Servervhostswww.lvtao.netcompanyjob.php on line 19
Notice: Use of undefined constant hy - assumed 'hywww:Server. line 20
Notice: Undefined variable: content in E:Servervhostswww.lvtao.netlibstemplate.core.php on line 557
進入網站會出現大量類似下面的提示,但是可以正常顯示和運行
Notice: Usena of untbund constant assumed 'ctbTitle' in d:ctb1.5ctbincludeconfig.php on line 23...
b答案:這些是PHP 的提示而非報錯,PHP 本身不需要事先聲明變數即可直接使用,但是對未宣告變數會有提示。一般作為正式的網站會把提示關掉的,甚至連錯誤訊息也被關掉
關閉PHP 提示的方法
搜尋php.ini:
error_reporting = E_ALL
改為:
error_reporting = E_ALL & ~E_NOTICE
還有個不是辦法的方法就是
在每個文件頭上加
error_reporting(0); 雖然不好弄但是可以解決問題! ! ! ! ! !這個比較好用




陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn