对象配置必须是一个包含“类"的数组.yii2 中的元素与 mongodb
Error > 使用 yii2+ mongodb 登录或注册时出现错误.
Error > while login or signup using yii2+ mongodb gives an error.
MongoDB 与 yii2 的连接完成.请帮我解决这个问题.
MongoDB connection with yii2 is done. please help me to solve this problem.
main-local.php
main-local.php
return [
'components' => [
'mongodb' => [
'class' => 'yiimongodbConnection',
'dsn' => 'mongodb://sameer:27017/demo',
],
'mailer' => [
'class' => 'yiiswiftmailerMailer',
'viewPath' => '@common/mail',
'useFileTransport' => true,
],
],
];
main.php
return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
'cache' => [
'class' => 'yiicachingFileCache',
],
'user' => [
'identityClass' => 'commonmodelsUser',
'enableAutoLogin' => false,
],
],
];
推荐答案
检查你的 vendoryiisoftextension.php在我安装了一个将不正确的配置数组添加到文件 vendoryiisoftextension.php 的软件包后,我遇到了同样的错误
Check your vendoryiisoftextension.php I had the same error after I had installed one package which add uncorrect config array to the file vendoryiisoftextension.php
'tigrov/yii2-country' =>
array (
'name' => 'tigrov/yii2-country',
'version' => '9999999-dev',
'alias' =>
array (
'@tigrov/country' => $vendorDir . '/tigrov/yii2-country/src',
),
'bootstrap' => 'tigrov\country\Bootstrap',
),
我已将上一个更改为下一个(只是将引导程序包装在数组中)
I've changed the previous one to the next one (just wrapped bootstrap in array)
'tigrov/yii2-country' =>
array (
'name' => 'tigrov/yii2-country',
'version' => '9999999-dev',
'alias' =>
array (
'@tigrov/country' => $vendorDir . '/tigrov/yii2-country/src',
),
array(
'bootstrap' => 'tigrov\country\Bootstrap',
)
),
相关文章