2016-11-18 79 views
0

我想這個代碼添加到應用程序的配置,我從這個link得到它。yii2應用程序配置位置路徑

return [ 
'modules' => [ 
    'admin' => [ 
     'class' => 'mdm\admin\Module', 
     ... 
    ] 
    ... 
], 
... 
'components' => [ 
    ... 
    'authManager' => [ 
     'class' => 'yii\rbac\PhpManager', // or use 'yii\rbac\DbManager' 
    ] 
], 
'as access' => [ 
    'class' => 'mdm\admin\components\AccessControl', 
    'allowActions' => [ 
     'site/*', 
     'admin/*', 
     'some-controller/some-action', 
     // The actions listed here will be allowed to everyone including guests. 
     // So, 'admin/*' should not appear here in the production, of course. 
     // But in the earlier stages of your development, you may probably want to 
     // add a lot of actions here until you finally completed setting up rbac, 
     // otherwise you may not even take a first step. 
    ] 
],]; 

但是,該文件位於哪裏? 我正在使用Yii2高級模板。

回答

0

您必須它位於後端和前端(根據您的要求)配置的主要文件中添加此。

在後端

Path : backend/config/main.php 

和前端

Path : frontend/config/main.php 

必須在各個組件

+0

哈哈,再次感謝:)添加所有的配置設置,你有沒有用yii2中的雙列表框? – Blackjack

+0

不,我還沒有使用它..你可以發佈你的單獨問題..都準備在這裏幫助.. –

+0

很高興聽到:DI希望你可以解決這個錯誤,就像另一個問題:D,這是[鏈接](http://stackoverflow.com/questions/40674952/error-when-trying-to-load-dual-listbox-in-yii2):) – Blackjack