0
我在開始使用CakePHP項目的過程中,我試圖以獲取登錄過程的理解,其次是創建一個包含登錄/用戶域的會話: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))));
}
在這一點上,我現在想在會話中創建用戶字段數會話變量,並將它們設置:
//Setting Session Variables:
$this -> Session -> write("name", $users['User']['fname'] . " " . $users['User']['lname']);
//Retrieving Session Variables:
echo $this -> Session -> read("name");
但我有設置會話變量的最後一部分麻煩。
問題:
如何爲用戶設置會話變量?
任何幫助表示讚賞傢伙...