简体   繁体   English

在我的 php 项目中,当我点击注销时,我正在主页重定向,如果我点击后退按钮,我将返回帐户页面

[英]In my php project when I clicked on logout, I am redirecting at home page, and if I click back button I am getting back in account page

In my php project when I clicked on logout, I am redirecting at home page, and if I click back button I am getting back in account page, I dont wont to let anyone to come back in account once they clicked logout, which is the best way to do this?.在我的 php 项目中,当我单击注销时,我在主页重定向,如果我单击后退按钮,我将返回帐户页面,一旦他们单击注销,我不会让任何人返回帐户,这是最好的方法来做到这一点? please rply.请回复。 Thnx谢谢

It would be useful to know more about the application. 了解有关该应用程序的信息将很有用。

Could it be that your browser is just caching the page? 可能是您的浏览器只是在缓存页面?

Check out this stack overflow link: Browser back button showing the page from cache? 检查此堆栈溢出链接: 浏览器后退按钮显示来自缓存的页面吗?

Add that header to your account page and see if it fixes it. 将该标头添加到您的帐户页面,看看是否可以解决。

Hope this is useful. 希望这是有用的。 Please comment if not. 如果没有,请发表评论。

There are multiple ways to solve this but i could simply do it with a JQuery which would redirect the user somewhere of my choice when i click the back button my browswer. 有多种方法可以解决此问题,但是我可以简单地使用JQuery做到这一点,当我单击浏览器的后退按钮时,它将将用户重定向到我选择的某个地方。 There are plethora of examples if you want but i will include one : link 如果您愿意,有很多示例,但我将提供一个示例: 链接

unset($_SESSION['variable_name']);

或者您也可以销毁会话以注销。

session_destroy();

Destroy the session:销毁会话:

session_unset();//Unset all session variables
session_destroy();

And maybe redirect users if they don't have a valid session.如果他们没有有效的会话,可能会重定向用户。 Add in your header something like在您的标题中添加类似

if(!isset($_SESSION['valid_user'])){
//Go to some other page
header("Location:$homepage");
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单击浏览器的后退按钮时如何在主页上重定向 - how can i redirect on the home page when i click on browser's back button 当用户单击注销并重定向到主页时,我想加载一个gif图像。 我正在尝试使用php - I want to load a gif image when user clicks on logout and then redirects to home page. i am trying to do using php 当我单击超链接时,我正在Laravel中找不到页面 - When I click on hyperlink I am getting page not found in Laravel 用户注销后单击“后退”按钮时,如何重定向到首页? - How can I redirect to home when user click on back button after logout? Codeigniter:当用户注销后单击“后退”按钮时,如何重定向到首页? - Codeigniter: How can I redirect to home when user click on back button after logout? 当我点击后退按钮时,我可以看到我上次受保护的页面 - When I click back button I can see my last protected page 将用户重定向回我的主页后,如何显示成功消息? - How do I display a success message after redirecting the user back to my home page? 我在laravel中开发注册表,但是单击“提交”按钮时,它不会重定向到我的登录页面,这是为什么? - i am developing a registration form in laravel but when the submit button is clicked it wont redirect to my login page why is that? 当我单击注销按钮时,而不是将我重定向到登录页面,它只是将login.php添加到已经存在的网址中 - when i click logout button, instead of redirecting me to the login page it just adds login.php to the already existing url 我在cart.php页面中遇到错误 - I am getting error in my cart.php page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM