php登录后返回到登录前的页面有关问题

WBOY
Release: 2016-06-13 11:08:13
Original
1133 people have browsed it

php登录后返回到登录前的页面问题

本帖最后由 cntegzs 于 2012-11-27 16:45:39 编辑 下面这个代码可以返回到登录前的页面:
登录
Copy after login

因为登录页面是:
user/login.php
Copy after login



如果下面这个登录页面:
index.php?mod=user&act=login
Copy after login

如何才能实现登录后返回到登录前的页面呢?
------解决方案--------------------
index.php?mod=user&act=login&url=xxx
以GET方式传参过去就可以了,
当然你的控制器要支持转向。
------解决方案--------------------
1、你可以把当前的url存一下,在前台就用cookie,后台形式就多了,session或数据库或文件。
2、把当前的url挂在login的链接后面,
   'index.php?mod=user&act=login&url='+encodeURIComponent(window.location.href);
登陆成功后,跳转到这个url指向的路径
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!