我想在登录到uri中的url后重定向。我现在的代码是:
if ( $count == 1 && $row['userPass']==$password && $row['online']=="N") {
$_SESSION['user'] = $row['userID'];
mysql_query("UPDATE users SET online='Y' WHERE userID=".$_SESSION['user']);
if (isset($_GET['url'])) {
$back==$_GET['url'];
header("Location: ".$back);
exit;
} else {
header("Location: /subdom/demo/");
exit;
}
}
但它重定向到主页面,而不是uri的页面。 URL类似于 localhost / subdom / demo / login.php?url = / subdom / demo / mixy.php 。为什么不起作用?
答案 0 :(得分:0)
您是否看到语法错误?
header("Location: $_GET['url]");
更改为
header("Location: ". $_GET['url']);
答案 1 :(得分:0)
在这里试试
if (!empty(@$_GET['url'])) {
header("Location: " . $_GET['url]);
exit;
} else {
header("Location: /subdom/demo/");
exit;
}
}