[英]How to redirect user back to the previous page after they login?
如果用户尚未登录,我有以下代码将用户重定向到登录页面。但是我想将他们页面重定向到他们登录后来自的页面,有什么想法要怎么做?
if(count($user)==0) redirect_page("/login.php");
您可以将路径添加到查询字符串,例如: /login.php?returnUri=/the/page/they/came/from.php
the/page/they/came/ /login.php?returnUri=/the/page/they/came/from.php
header('Location: ' . $_SERVER['HTTP_REFERER']);
exit;
if(count($user)==0){
echo "<script>JavaScript:history.back()</script>";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.