2015-08-21 71 views
0

一樣的標題,我想創建配置文件爲警予每個模塊創建配置文件,例如:每個模塊的Yii版本1

test/ 
    TestModule.php    the module class file 
    components/    containing reusable user components 
    config/     containing config class files 
     main.php    the config file <=== 
    views/      containing view files for widgets 
    controllers/    containing controller class files 
     DefaultController.php the default controller class file 
    models/     containing model class files 
    views/      containing controller view and layout files 
     layouts/    containing layout view files 
     default/    containing view files for DefaultController 
     index.php 

什麼解決的辦法?有人能幫助我嗎?

回答

0

您可以修改您的主配置,並指向配置文件爲每個模塊:

return array(
    ...... 
    modules => array (
      require('path./to/configfile1.php'); //first module config 
      require('path/to/configfile2.php'); //second module config 
    ), 
    ....... 
) 

,並在你的模塊配置文件

return array(
    'class' => 'alias.to.class', 
    'param1' => 'val1' 
    ....... 

)