[英]exit() Doesn't work?
我有這個PHP腳本,它不在函數內
$num = mysql_num_rows($result);
if ($num == 0)
{
header("Location:index.php#captcha");//Location:#errorlogin.html");
$_POST[password]="";
exit;
}
無論$ num等於0,我似乎總是繼續執行此部分之后的所有操作,我已經嘗試過exit(“ message”),死,返回等。對不起,如果這是一個討厭的問題,哈哈
$_POST[password]="";
可能應該是(請注意'
):
$_POST['password'] = "";
函數exit()
在執行時肯定會停止執行。 您的if條件一定有問題。
在PHP中,多個值“等於”為零(如果使用==
)。 試試var_dump($num)
看看里面到底有什么。
exit
將不起作用,因為它有2個依賴項
A. if ($num == 0)
如果$num
不為零,則退出將不起作用
B. header("Location:index.php#captcha");
如果您的位置正常,出口將不會損壞
嘗試
$num = mysql_num_rows ( $result );
if ($num == 0) {
$_POST ['password'] = null;
header ( "Location: http://yoursite.com/index.php#captcha" ); // Location:#errorlogin.html");
exit();
}
else
{
echo "Found $num in the database";
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.