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);
以上內容轉自(http://www.cnblogs.com/zhxlsuyu/archive/2012/02/18/2357110.html)
<hr/>
查詢數據庫數據排序問題:
select * from table order by time desc(日期倒序顯示即從最近一條內容顯示)