0
我試圖安裝和配置yii2用戶模塊到我的yii2基本應用。但它不工作:yii2用戶類「警予網絡 AccessControl的」未找到
首先將此添加到composer.json文件:
"dektrium/yii2-user": "*"
和更新的作曲家。然後,只需添加在$配置不是內部的元件部分的代碼在配置/ web.php文件:
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
],
],
然後添加到了佈局/ main.php:
$navItems=[
['label' => 'Home', 'url' => ['/site/index']],
['label' => 'Status', 'url' => ['/status/index']],
['label' => 'About', 'url' => ['/site/about']],
['label' => 'Contact', 'url' => ['/site/contact']]
];
if (Yii::$app->user->isGuest) {
array_push($navItems,['label' => 'Sign In', 'url' => ['/user/login']],['label' => 'Sign Up', 'url' => ['/user/register']]);
} else {
array_push($navItems,['label' => 'Logout (' . Yii::$app->user->identity->username . ')',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']]
);
}
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $navItems,
]);
我有兩個菜單按鈕: 「登錄」 和 「註冊」 後來,當我試圖進入這個網址:
的mysite/index.php的R =用戶%2Fregistration%2Fregister
它配備:
Class 'yii\web\AccessControl' not found
in vendor/dektrium/yii2-user/controllers/RegistrationController.php at line 34
,或者當我打登錄我的應用程序按鈕,說到沒有發現頁文件