我這裏有這個疑問,我添加到我的網址的status=1&time=1030&start=Toronto&end=Boston
PHP驗證查詢
我找結束客場以驗證這些,看看狀態,時間(時間只有4個字符),開始並最終
我試過如下:
if(!isset($_GET['status'])){
//error message and die
}
if(!isset($_GET['time']) || $_GET['time'] < 4){
//error message and die
}
if(!isset($_GET['start'])){
//error message and die
}
if(!isset($_GET['end'])){
//error message and die
}
但它始終顯示第一條錯誤消息和死亡,甚至認爲其在query.How做我解決這個問題?
您必須做一些錯誤的,因爲預期它應該工作。檢查錯字... – samayo
這看起來很明顯,但是你在添加'status = 1&time = 1030&start = Toronto&end = Boston'之前放了一個'?'像這樣:'www.mysite.com?status=1&time=1030&start=Toronto&end=Boston '。 – searsaw
$ _GET ['time'] <4,你的意思是strlen($ _ GET ['time'])<4? – TroyCheng