且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

配置Yii2中的多个用户身份

更新时间:2023-09-12 10:26:10

尝试在用户两个组件中设置类属性:

Try to set a class property in the user-two component:

'user-two' => [
    'class' => 'yii\web\User'
    'identityClass' => 'app\models\SecondUser',
    'enableAutoLogin' => true,
],

或创建从yii \ web \ User类继承的新类,并进行如下设置:

or create new class inherited from the yii\web\User class and set like this:

'user-two' => [
    'class' => 'app\models\NewClassInheritedFromUserClass'
    ....
]

也许这会对您有所帮助.

Maybe this will help you.