小编roo*_*lka的帖子

配置Yii2中的多个用户标识

我开发了一个有两个不同注册的站点,我有2个不同的表,我使用RbacDB,并在组件部分的web配置中我有用户配置,根据这个我想知道我怎么可以使用2个不同的字段配置文件?

配置:

'components' => [
    'request' => [
        // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
        'cookieValidationKey' => '213h2i3121h12osiajls',
    ],
    'cache' => [
        'class' => 'yii\caching\FileCache',
    ],
    'user' => [
        'identityClass' => 'app\models\User',
        'enableAutoLogin' => true,
    ],
    // Here after user I need to add another config user-two
    'user-two' => [
        'identityClass' => 'app\models\SecondUser',
        'enableAutoLogin' => true,
    ],
Run Code Online (Sandbox Code Playgroud)

当我这样做时,显示此错误 在此处输入图像描述

谢谢!

yii2 yii2-rbac

3
推荐指数
1
解决办法
3671
查看次数

标签 统计

yii2 ×1

yii2-rbac ×1