小编pus*_*hpa的帖子

如何杀死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');
}
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");

但我没有得到我的控制器的哪一部分我应该粘贴这个代码?请帮我....

cakephp cakephp-1.3

2
推荐指数
1
解决办法
9228
查看次数

如何使用cakephp电子邮件组件发送电子邮件?

我尝试使用cakephp电子邮件组件发送邮件.但是邮件没有发送,也没有显示任何错误消息.我需要设置任何其他参数吗?这是我的代码片段:

            $this->Email->from='<xyz@yahoo.com>';
    $this->Email->to='<abc@gmail.com>';
    $this->Email->sendAs='both';
    $this->Email->delivery = 'debug';
    $this->Email->send();
Run Code Online (Sandbox Code Playgroud)

cakephp-1.3

1
推荐指数
1
解决办法
8731
查看次数

标签 统计

cakephp-1.3 ×2

cakephp ×1