且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Yii 中更改控制器的位置

更新时间:2023-02-12 15:14:05

根据你的配置文件,它应该是这样的:

According to your config file, it should look like:

'controllerPath'=>'protected/backoffice',  <== Add this line
'import'=>array(
    'application.models.*',
    'application.components.*',
    //'application.backoffice.*',  <=== You don't need this
),

您可以通过以下方式在后台实现单控制器:从 main.php 中删除 controllerPath 并添加以下内容:

You can achieve the single controller in backoffice by: Removing the controllerPath from main.php and add the following:

'controllerMap'=>array(
    'booklet'=>array(
        'class'=>'application.backoffice.Booklet', //<== Your controller name
    ),        
),