简体   繁体   English

如何在Yii2中设置defaultRout指向模块控制器?

[英]How to set the defaultRout in Yii2 to point to a module controller?

How can one set the defaultRoute in yii2 to point to a module controller instead of the site controller. 如何在yii2中将defaultRoute设置为指向模块控制器而不是站点控制器。

$config = [
   'defaultRoute' => 'app\modules\test\controllers\DefaultController',
'modules' => [
    'test' => [
        'class' => 'app\modules\test\Module',
    ],
],

I had set the path in the array above, however it gave me an error 我已经在上面的数组中设置了路径,但是它给了我一个错误

Thank you in advance 先感谢您

the correct path is the modulename/controllername 正确的路径是模块名/控制器名

'defaultRoute' => 'modulename/default',

thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM