首页 > yii2 访问backend/web/index.php 提示如下,如何解决

yii2 访问backend/web/index.php 提示如下,如何解决

Invalid Configuration – yiibaseInvalidConfigException

User::identityClass must be set.


不是提示你了么~用户的认证类是必须要设置的。
在config下面的主配置文件(main.php 或者 web.php),里面的user,下面的class要对应到你验证的模型类上面去。
要是不用用户验证。把整块删掉就行了。


return [
    'components' => [
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
        ],
    ],
]
【热门文章】
【热门文章】