简体   繁体   中英

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.

$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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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