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); 雖然不好弄但是可以解決問題!!!!!!這個我最喜歡,嘿嘿