0

好的,所以我想要发生的是当用户注销时,我的脚本应该检查代码 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>";
}
?>
4

1 回答 1

6

因为比较运算符是==,不是=

所以你需要有

if ($err == "1") {
于 2012-04-19T00:02:10.150 回答