安装Yii2.0的用户管理

时间:2015-09-06 09:25:36

标签: installation yii2 user-management

我一直在尝试为Yii2.0安装user-management,但在加载页面时会收到ReflectionException。我在下面附上了错误页面和目录结构。enter image description here

,文件路径如下所示。 enter image description here

我经常搜索以找出原因,但没有成功。谁能告诉我,我在这里失去了什么才能让它发挥作用。看起来user-management installation documentation有一些缺陷。目前还不清楚。希望得到安装的步骤。感谢

这是我的console / web.php

    <?php

$params = require(__DIR__ . '/params.php');

$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
    'request' => [
        // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
        'cookieValidationKey' => 'gAry7SfUr0oOjNQDqItsobmGBcJajQoW',
    ],
    'cache' => [
        'class' => 'yii\caching\FileCache',
    ],
    'user' => [
        //'identityClass' => 'app\models\User',
        'enableAutoLogin' => true,
        'class' => 'app\webvimark\modules\user-management\components\UserConfig',

    // Comment this if you don't want to record user logins
    'on afterLogin' => function($event) {
            \webvimark\modules\user-management\models\UserVisitLog::newVisitor($event->identity->id);
        }
    ],
    'errorHandler' => [
        'errorAction' => 'site/error',
    ],
    'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        // send all mails to a file by default. You have to set
        // 'useFileTransport' to false and configure a transport
        // for the mailer to send real emails.
        'useFileTransport' => true,
    ],
    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'targets' => [
            [
                'class' => 'yii\log\FileTarget',
                'levels' => ['error', 'warning'],
            ],
        ],
    ],
    'db' => require(__DIR__ . '/db.php'),
],

'modules'=>[
'user-management' => [
    'class' => 'webvimark\modules\user-management\UserManagementModule',

    // 'enableRegistration' => true,

    // Here you can set your handler to change layout for any controller or action
    // Tip: you can use this event in any module
    'on beforeAction'=>function(yii\base\ActionEvent $event) {
            if ( $event->action->uniqueId == 'user-management/auth/login' )
            {
                $event->action->controller->layout = 'loginLayout.php';
            };
        },
    ],
],
'params' => $params,
];

if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
    'class' => 'yii\debug\Module',
];

$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
    'class' => 'yii\gii\Module',
];
}

return $config;

1 个答案:

答案 0 :(得分:0)

此扩展程序的预期配置似乎略有不同。

使用此

'class' => 'webvimark\modules\UserManagement\components\UserConfig',

UserManagement而不是user-management是配置路径,而不是路径