
在UserIdentity中添加如下方法
[php]
public static function createAuthenticatedIdentity($user) {
$identity=new self($user->id,'');
$identity->_name = $user->username;
$identity->_id = $user->id;
$identity->setState('userInfo', $user);
$identity->errorCode=self::ERROR_NONE;
return $identity;
}
[/php]
用法:
[php]
Yii::app()->user->login(UserIdentity::cre...