pus*_*hpa 2 cakephp cakephp-1.3
我在登录模块上工作.在注销功能中,我按如下方式编写代码,首先终止会话,然后将其重定向到主页.它工作正常但会话没有破坏.如果有人知道请帮助我这是我的登录和注销代码片段:
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');
}
Run Code Online (Sandbox Code Playgroud)
我得到的信息是,我必须保留标题信息,下面是我的代码片段:$ this-> header("Cache-Control:no-cache,no-store,must-revalidate"); $ this-> header("Expires:Mon,1970年1月1日00:00:00 GMT");
但我没有得到我的控制器的哪一部分我应该粘贴这个代码?请帮我....