注销功能在代码点火器 [英] logout feature in code igniter

查看:165
本文介绍了注销功能在代码点火器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始为我的项目使用codeigniter。我有我的网站的用户验证系统。我看到了nettuts的视频的登录信息。我困惑为什么注销不能正常工作。

I started using codeigniter for my project. I have user authentication system for my website. I have seen the videos from nettuts for the login information. I am confused why the logout is not working properly.

我在登录控制器中具有以下退出功能。

I have the following logout function in my login controller.

function logout() {
        $this->session->sess_destroy();
        redirect('main');
    }

如果我点击注销按钮我将用户重定向到主页。但在将用户重定向到主页后,如果点击浏览器上的后退按钮,我会在页面顶部看到注销和我的名字。我需要一些帮助,我在哪里我错了或有任何重要的代码我缺少在我的控制器

If I click on the logout button I am redirecting the user to the main page. But after redirecting the user to the main page, if click on the back button on the browser I will see the logoff and my name on the top of the page. I need some help on where I am going wrong or is there any important piece of code I am missing in my controller

提前感谢

EDIT

我认为我找到了解决方案。我应该将以下代码附加到相应的控制器中

I think I found the solution. I should append the following code into the appropriate controller

$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache"); 


推荐答案

我认为这是一个浏览器缓存问题。如果您点击回来,您实际上看到的是已缓存的网页,这是您登录后的方式。

I think this is a browser cache issue. If you click back you are actually seeing the cached page, the way it was when you were logged in.

尝试在退出之前退出F5页。现在应该显示您已退出。

Try and hit F5 when just after going back to the before logout page. It should now show that you are logged out.

这篇关于注销功能在代码点火器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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