/** * 更新用户在session中的数据 */ private function updateUserInfo() { $model = new AdminUser(); $user = Yii::app()->user; $username = $user->getId(); $usermodel = $model->find('username = :name', array(':name' => $username)); if ($usermodel == null) { throw new CHttpException(404, '非正常用户'); } else { $user->setState('userInfo', $usermodel->attributes); } }