CakePHP注销问题 [英] CakePHP Logout issues

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

问题描述

我知道这必须是真的很蠢,但我有退出的问题。我仍然可以看到完整的用户Auth变量调用Auth-> logout()后。在我的用户控制器中,我有标准:

  function login()
{
} $ b b
function logout()
{
$ this-> redirect($ this-> Auth-> logout());
}

但是当我调用logout时,在我看来,这样做:

  $ auth = $ this-> Session-> read('Auth.User'); 
print< pre>;
print_r($ auth);
print< / pre>;

我缺少一些基本的东西吗?感谢!

解决方案

您不允许使用注销功能,用户被重定向而不是注销。 p>

在您的控制器中包含注销功能,请将其添加到您的过滤器中:

  $ this-> Auth-> allow('logout'); 


I know this must be something really stupid, but I am having issues with logging out. I can still see the full user Auth variable after calling Auth->logout(). In my users controller I have the standard:

function login()
{
}

function logout()
{
  $this->redirect($this->Auth->logout());
}

But when I call logout, in my view I can still print the User by doing this:

$auth = $this->Session->read('Auth.User');
print "<pre>";
print_r($auth);
print "</pre>";

Am I missing something basic here? Thanks!

解决方案

you have not allowed the use of the logout function, and the user is redirected instead of logged out.

in your controller containing logout the function, add this in your before filter:

    $this->Auth->allow('logout');

这篇关于CakePHP注销问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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