以下是Yii相关配置的总结:
1,/protected/config/main.php中的配置:
1)       修改默认 Controller 下载下来的源代码 默认 Controler siteController
protected/config/main.php 中,修改键 defaultController 的值为指定的 controller ,在该 controller 中须指定默认 action 。当 request 中未明确目的时,采用 defaultController/defaultAction 来响应。
'defaultController'=>'main',

设置后访问网站根路径即可跳到对应的 Controller MainController.php
下载下来的源代码 默认为 site ,是在yiilite.php文件中指定,所以示例中跳转到 SiteController.php
2)       修改默认登录 action
当未知名登录页面时,当未登录而访问需要登录的页面时, Yii 会跳转到默认登录 Action ,默认 Action site/login ,这也可以在 main.php 或模块配置文件中自定义
'components'=>array(

       'user'=>array(

           'allowAutoLogin'=>true,

           'loginUrl'=>array('main/login.html'), 

       ),

3)       数据库连接的定义:
       'db' => array (

           'connectionString' => 'mysql:host=localhost;dbname=db_schema' ,

           'emulatePrepare' => true ,

           'username' => 'root' ,

           'password' => '123' ,

           'charset' => 'utf8' ,

           'tablePrefix' => 'zz_' ,

       ),
 
4)       默认错误 Action 的定义,发生错误时将调用该 Action
       'errorHandler' => array (

           'errorAction' => 'main/error' ,

       ),
 
5)       添加模块:
'modules'=>array(

       …, // 其它模块

       'admin',     

    ),

添加之后方可通过路径访问:
或者:
http://127.0.0.1:8080/zuizen/admin/ 若按上一节修改了访问路径为path方式
 
 
6)       配置和修改 Yii 代码生成工具 Gii
    'modules' => array (

       'gii' => array (

           'class' => 'system.gii.GiiModule' ,

           'password' => '123' ,

           'ipFilters' => array ( '127.0.0.1' , '::1' ),

        ),
 
 
2,在Controller 中的定义:

Controller 的父类为 CController ,其中定义了 Controller 的一些变量。
1)       定义 Layout
public $layout='/layouts/admin';

// 表示绝对路径, / 表示相对路径
2)       定义默认 Action
public $defaultAction='index';

 
3,在模块Modules 中的定义,如AdminModule

1)       模块类的父类 CWebModule 中定义了部分变量:
public $defaultController='default';
public $layout;
public $controllerNamespace;
2)       AdminModule init 函数中 定义该模块内的默认错误 Action
                   Yii::app()->errorHandler->errorAction = 'admin/default/error';
3)       AdminModule init 函数中定义模块内默认 Controller
                   Yii::app()->defaultController = 'admin/default';
4)       AdminModule init 函数中定义模块内默认登录 Action
                   Yii::app()->user->loginUrl = 'admin/default/login';