如何使用 我不想让他们通过 例如,我想获取当前登录用户的用户名和名称: p>
和 p>
<预 > 添加或获取变量Yii :: $ app-&gt; user-&gt ; code>? p>
identity code>。 我想通过
user code>来访问特定的。 p>
<代码> \的Yii :: $ APP-&GT;用户&GT;用户名
代码> PRE>
\ Yii :: $ app-&gt; user-&gt; name
code> pre>
div>
How do you add, or get, variables using Yii::$app->user->something
?
I don't want to get them through identity
. I want to make specific ones accessible through user
.
For example, I want to get the current logged in user's username and name:
\Yii::$app->user->username
or
\Yii::$app->user->name