How to add more user identity session attributes in Yii2?

前端 未结 4 1157
说谎
说谎 2021-02-01 05:54

In Yii2 you can access the identity interface for the current user by using the identityInterface object from within the \\yii\\web\\User class with something like this

4条回答
  •  独厮守ぢ
    2021-02-01 06:26

    In Yii2 \Yii::$app->user->identity contain instance of the identityClass. So, if you want some identityClass-related data - just use it like instance of the identityClass.

提交回复
热议问题