好吧,所以我想要發生的是當用戶註銷我的腳本時,應該檢查代碼2的URL並顯示給用戶他們已經註銷。如果1有密碼或用戶名錯誤,3不確定他們如何到達那裏。它拉正確的數量,但將只顯示1的消息,我不知道什麼是錯:/問題如果陳述
<?php
$err = $_GET['err'];
echo $err;//Proof the code is getting number
if ($err = "1") {
echo '<center><span class="error-box">'; echo "Whoops! Wrong Username or Password. Please try again.</span></center>";
}
elseif ($err = '2') {
echo '<center><span class="info-box">'; echo "You Have Been Succesfully Logged Out.</span></center>";
}
else {
echo '<center><span class="info-box">'; echo "Whoops! Somthing funny happened and were not quite sure what your trying to do. Please try again.</span></center>";
}
?>
你需要改變所有的=因爲它是一個賦值運算符 有==比較運算,它無需關心 像1型比較纔有價值如整數,當您使用==「1」作爲字符串,它返回TURE ===它比較值和類型都 像$ VAR1 = 1;和$ var2 =「2」;如果你使用===它將返回false,如果你使用==它將返回真 – 2012-04-19 00:05:11