我试过了
public function getName() { return 'TEST'; }@H_301_3@在UserIdentity.PHP但它似乎没有改变Yii :: app() – > user-> name的值
在您定义的UserIdentity类中,您需要使用setState(name,value)方法设置新状态.
@H_301_3@例如,在方法中验证用户是否良好:
> The setState() documentation
//if the user is good (good login and good password) $this->_id=$record->id; $this->setState('name',$record->name); $this->errorCode=self::ERROR_NONE;@H_301_3@然后,您将能够调用Yii :: app() – > user-> name @H_301_3@> A complete example in the Yii guide
> The setState() documentation