Home  >  Article  >  Backend Development  >  小弟我要注册或者登陆后,跳转到当前浏览的页面,如何实现

小弟我要注册或者登陆后,跳转到当前浏览的页面,如何实现

WBOY
WBOYOriginal
2016-06-13 10:33:02953browse

我要注册或者登陆后,跳转到当前浏览的页面,怎么实现?
我要注册或者登陆后,跳转到当前浏览的页面,怎么实现?

------解决方案--------------------
header
location
------解决方案--------------------
1楼告诉你了

header

//注册验证通过
if($isReg){
header('Location: http://www.example.com/index.php');
}

函数用法
http://www.w3school.com.cn/php/func_http_header.asp
------解决方案--------------------
你需要记录之前的页面,方法就很多了。在url 或者session/cookie 都可。
------解决方案--------------------
header
location
js
------解决方案--------------------
header('Location: http://www.php.com/index.php');
 or
 
------解决方案--------------------
把上一次页面URL记录在SESSION里即可, 点击注册提交表单之后你的php根据session内的记录做一次Location。

可以封装一个方法,每个需要记录的页面都调一下以便记录在SESSION里。
------解决方案--------------------

探讨
把上一次页面URL记录在SESSION里即可, 点击注册提交表单之后你的php根据session内的记录做一次Location。

可以封装一个方法,每个需要记录的页面都调一下以便记录在SESSION里。

------解决方案--------------------
开启 session 之后 跳转 header location 要跳转到你需要你的页面
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn