2011年6月17日 星期五

Undefined index 錯誤PHP

資料來源:http://plog.tcc.edu.tw/post/530/12708

治標不治本的就是將php.ini內的reporting部份修改,讓notice不顯示
error_reporting = E_ALL; display all errors, warnings and notices
改成
error_reporting = E_ERROR & ~E_NOTICE & ~E_WARNING

不然
isset($_GET["page"])做個if-else判斷!!

或者在這段敘述前面加上'@'表示這行敘述如果有錯誤或是警告時不要輸出
如:@$page=$_GET["page"]

沒有留言: