How to set default controller in Yii

后端 未结 3 1457
无人及你
无人及你 2021-02-20 15:36

Is there a way to specify a default controller in Yii? Instead of using the SiteController? Thank you in advance.

相关标签:
3条回答
  • 2021-02-20 16:05

    To set your default controller as your homepage's controller on Yii PHP-Framework. You must modify the core defaults controller (site/index) on your /protected/config/main.php

    return array(
        'name' => 'Web Application',
        'defaultController' => 'home ', 
    
    );
    
    0 讨论(0)
  • 2021-02-20 16:14

    also there is another way to do that

    change the values of public $defaultController property in

    framework/web/CWebApplication.php

    0 讨论(0)
  • 2021-02-20 16:15

    try to add the configuration in the config main.php

    'defaultController' => 'newcontrollername',
    

    after 'name' setting.

    0 讨论(0)
提交回复
热议问题