我开发了一个有两个不同注册的站点,我有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)
当我这样做时,显示此错误 在此处输入图像描述
谢谢!
尝试在user-two组件中设置class属性:
'user-two' => [
'class' => 'yii\web\User'
'identityClass' => 'app\models\SecondUser',
'enableAutoLogin' => true,
],
Run Code Online (Sandbox Code Playgroud)
或者创建从yii\web\User类继承的新类,并设置如下:
'user-two' => [
'class' => 'app\models\NewClassInheritedFromUserClass'
....
]
Run Code Online (Sandbox Code Playgroud)
也许这会对你有所帮助.
| 归档时间: |
|
| 查看次数: |
3671 次 |
| 最近记录: |