当我尝试登录或注册时,它不起作用。如果我使用错误的凭据进行登录,则可以成功登录。但是如果我使用正确的凭据,则会出现错误:
“Object configuration must be an array containing a "class" element.”
出错行:
“Object configuration must be an array containing a "class" element.”
出错行:
static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]);
和相关的行
$models = $this->createModels($rows);
我的配置如下
main.php
return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
],
];
main-local.php
return [
'components' => [
'mongodb' => [
'class' => '\yii\mongodb\Connection',
'dsn' => 'mongodb://mts:123456@localhost:27017/mangodb',
],
'user' => [
'identityClass' => 'common\models\User', // This is your class with IdentityInterface
'enableAutoLogin' => true,
],
],
];
enableAutoLogin
的值从 true 改为 false。 - vishuB