重定向到php中的旧页面? [英] Redirect to older page in php?

查看:46
本文介绍了重定向到php中的旧页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,用户转到profile.php"页面,但它需要登录.然后它重定向到登录页面.但是登录后,它应该重定向回 profile.php 页面.我该怎么做?

如何在 php 中获取当前 URL?

$_SERVER['URI']????

解决方案

大多数站点简单地将一个变量传递给登录表单,如下所示:

<预><代码>重定向(login.php?returnUrl=original_page.php);

然后在处理登录后,它可以重定向回 returnUrl 指向的页面.如果没有 returnURl 变量,则调用默认的(index.php 或 default.php).

希望对您有所帮助.

Lets say, user go to "profile.php" page, but it requires login. Then it redirects to login page. But after login, it should redirect back to profile.php page. How do i do that?

How to get current URL in php?

$_SERVER['URI']????

解决方案

Most sites simply pass a variable to the login form like this:


redirect(login.php?returnUrl=original_page.php);

Then after the login is processed, it could redirect back to the page which returnUrl is pointing to. If there is no returnURl variable, then call the default one (index.php or default.php).

Hope this help.

这篇关于重定向到php中的旧页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆