RBAC路由是否将模块的默认路由添加到项目的所有路由?

时间:2019-01-09 13:50:46

标签: yii2 yii2-advanced-app yii2-user

如果我将build_requires模块的此配置添加到配置文件中

var bla : real = 0.1;
wait delay (bla * 1 ns);

它将此模块的默认路由添加到所有这样的路由中 cms 'cms' => [ 'class' => 'yii2mod\cms\Module', 'controllerNamespace' => 'backend\controllers', 'defaultRoute' => '', 'froalaEditorOptions' => [ 'clientOptions' => [ 'heightMin' => 300, 'theme' => 'dark', 'imageUploadURL' => 'upload-image', 'imageManagerDeleteURL' => 'delete-image', 'imageManagerDeleteMethod' => 'POST', 'imageManagerLoadURL' => 'images' ], 'excludedPlugins' => [ 'file', 'emoticons' ] ], 'enableMarkdown' => false ] /cms/site/login。为什么会发生这种情况,以及如何将其删除?

1 个答案:

答案 0 :(得分:1)

如果要默认删除/ cms模块前缀,则可以向backend/config/main.php添加全局路由(如果使用高级模板):'<controller:[\w-]+>/<action:[\w-]+>' =>'cms/<controller>/<action>'

例如:

// backend/config/main.php
return [
    'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
            '<controller:[\w-]+>/<action:[\w-]+>' =>'cms/<controller>/<action>'
        ],
    ],
];

您的Bowser中的访问权限为www.xxx.com/site/index,该访问权限将转发给/cms/site/index