模块可以有自己的配置文件吗?

Hil*_*lmi 5 yii

我只想知道是否可以添加扩展模块中main.conf的配置文件

小智 2

已经是这样了。在CWebModule中通过$this->setComponents如下:

<?php

    class AccountModule extends CWebModule
    {
        public function init()
        {
            // this method is called when the module is being created
            // you may place code here to customize the module or the application

            $this->setComponents(array(
                'errorHandler' => array(
                        'errorAction' => 'module/default/error'),
                'defaultController' => 'default',
                'user' => array(
                        'class' => 'ModuleWebUser',
                        'allowAutoLogin'=>true,
                        'loginUrl' => Yii::app()->createUrl('module/default/login'),
                )
            ));

            // import the module-level models and components or any other components..
            $this->setImport(array(
                'module.models.*',
                'module.components.*',
            ));
        }
} ?>
Run Code Online (Sandbox Code Playgroud)