Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Session CakePHP登录和会话管理_Session_Cakephp_Login - Fatal编程技术网

Session CakePHP登录和会话管理

Session CakePHP登录和会话管理,session,cakephp,login,Session,Cakephp,Login,我正在使用CakePHP启动一个项目,我试图了解登录过程,然后创建一个包含登录/用户字段的会话: function login_php(){ // -=> Retrieve form fields "u" and "p" (Username and password): $a = $this->params['form']['u']; //email address. $b = $this->params['form']['p']; //password

我正在使用CakePHP启动一个项目,我试图了解登录过程,然后创建一个包含登录/用户字段的会话:

function login_php(){
    // -=> Retrieve form fields "u" and "p" (Username and password):
    $a = $this->params['form']['u']; //email address.
    $b = $this->params['form']['p']; //password.

    // -=> Query Retrieve User, match email and password fields:
    // -=> Make users data available in the view:
    $this->set('users', $this->User->find('all', array('conditions' => array('User.email =' => $a , 'User.password =' => $b))));
}
现在,我想从users字段创建一些会话变量,并在会话中设置它们:

    //Setting Session Variables:
    $this -> Session -> write( "name", $users['User']['fname'] . " " . $users['User']['lname']);

    //Retrieving Session Variables:
    echo $this -> Session -> read("name");
但是我在设置会话变量的最后一部分遇到了问题

问题:

如何为用户设置会话变量


感谢各位的帮助。

您知道cake已经安装了身份验证模块,是吗


您知道cake已经安装了身份验证模块,是吗