PHP運行出現Notice : Use of undefined constant 的完美解決方案


Notice: Use of undefined constant title - assumed 'title' in F:\wamp\www\load_myweb.php on line 22
Notice: Use of undefined constant content - assumed 'content' in F:\wamp\www\load_myweb.php on line 22

進入網站會出現大量類似下面的提示,但是可以正常顯示和運行

  Notice: Use of undefined constant title - assumed 'title' in F:\wamp\www\load_myweb.php on line 22

  這些是 PHP 的提示而非報錯,PHP 本身不需要事先聲明變量即可直接使用,但是對未聲明變量會有提示。一般作為正式的網站會把提示關掉的,甚至連錯誤信息也被關掉

  關閉 PHP 提示的方法

  搜索php.ini:

  error_reporting = E_ALL

  改為:

  error_reporting = E_ALL & ~E_NOTICE

  還有個不是辦法的辦法就是

  在每個文件頭上加

  error_reporting(0); 雖然不好弄但是可以解決問題!!!!!!這個我最喜歡,嘿嘿


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM