Session CakePHP登录和会话管理
我正在使用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
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已经安装了身份验证模块,是吗