[教學] 一招就能快速解決 PHP Notice: undefined index 錯誤訊息(_GET/_POST)
2019/10/24![梅問題-[教學] 一招快速解決PHP Notice: undefined index問題(_GET/_POST)](http://photo.minwt.com/img/Content/php/php-notice-undefined-index/php-notice-undefined-index_00.jpg)
而那一個錯誤碼,則是說明該參數尚未被定義,這也確實因為也沒有接到任何的參數,而要解決這問題,就是得加入判斷式,去判斷目前的這參數值是否存在,若只是一、二個參數倒還好,當一多時還真是寫到手軟,因此梅干找了好久,竟然發現一招超簡單的方法,立即就能解決未定的錯誤訊息啦!
Step1
當未傳入任何參數時,開啟該頁面時,就會出現Undefined index xx的錯誤訊息。
![梅問題-[教學] 一招快速解決PHP Notice: undefined index問題(_GET/_POST)](http://photo.minwt.com/img/Content/php/php-notice-undefined-index/php-notice-undefined-index_01.jpg)
Step2
而第二行就是,透過GET的方式,進行參數的傳送。
![梅問題-[教學] 一招快速解決PHP Notice: undefined index問題(_GET/_POST)](http://photo.minwt.com/img/Content/php/php-notice-undefined-index/php-notice-undefined-index_02.jpg)
Step3
解法方法很簡單,只需在前方,加入一個 @,就可搞定。
![梅問題-[教學] 一招快速解決PHP Notice: undefined index問題(_GET/_POST)](http://photo.minwt.com/img/Content/php/php-notice-undefined-index/php-notice-undefined-index_03.jpg)
Step4
當加入完畢後,再重新整理頁面,這樣錯誤碼就不再出現啦!是不是超簡單的,連判斷式都省了。
![梅問題-[教學] 一招快速解決PHP Notice: undefined index問題(_GET/_POST)](http://photo.minwt.com/img/Content/php/php-notice-undefined-index/php-notice-undefined-index_04.jpg)
※如有發現掉圖或檔案無法下載,請由回應區留言告知,將會盡速處理!
※本站採用CC授權請勿全文轉貼本站文章,歡迎「部份引用」與介紹,並註明出處,謝謝。
※本站採用CC授權請勿全文轉貼本站文章,歡迎「部份引用」與介紹,並註明出處,謝謝。
回應本文