我正在登錄模塊上工作。在註銷功能中,我使用下面的代碼,先殺掉會話,然後重定向到主頁。它工作正常,但會話沒有破壞。 如果有人知道請幫我 這裏是我的登錄&註銷的代碼片段:如何殺死cakephp中的會話
function login()
{
if(!empty($this->data))
{
$user1= $this->User->validateLogin($this->data['User']);
if($user1== true)
{
$this->redirect(array('action'=>'index'));
}
else
{
$this->Session->setflash('Login failed, Try again');
}
}
}
function logout()
{
$this->Session->delete('User');
$this->redirect('/users/index');
}
我得到了,我要保持頭的信息,下面是我的代碼片段: $這個 - >頭( 「Cache-Control:no-cache,no-store,must-revalidate」); $ this-> header(「Expires:Mon,1970年1月1日00:00:00 GMT」);
但是m沒有進入我的控制器的哪個部分我應該粘貼這段代碼?請幫助我....
:
否則你破壞cookies和其它用戶定義的設置,這將是非常惱人的(語言,...)
但官方蛋糕的方法是auth(cakephp sessin變量你不需要刪除會話mannually ....我想你錯過了這部分 – jack 2012-07-23 09:49:51