Yii main配置文件解析
一、Yii main.php配置文件解析
return array( //app目录地址 'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..', 'name' => 'My Web Application', //需要预载入的部件 'preload' => array('log'), //自动包含类的配置 'import' => array( 'application.models.*', 'application.components.*', ), //注册可用模块,gii的配置也在这里 'modules' => array( 'dashboard','paypal' ), // 这里就是配置上面说的核心部件以及自定义部件的地方了,具体每个部件的配置具体看其类 'components' => array( 'user' => array( 'class'=>'application.components.CTradeUser', 'allowAutoLogin' => true, ), 'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false, 'rules'=>array( ), ), 'authManager'=>array( 'class'=>'CDbAuthManager', 'defaultRoles'=>array('guest'), 'itemTable'=>'authitem', 'itemChildTable'=>'authitem_child', 'assignmentTable'=>'auth_assignment' ), //默认的数据库链接,可以配置多个,不过配置时必须明确指定class 'db' => array( 'connectionString' => 'mysql:host=localhost;dbname=milestone', 'emulatePrepare' => true, 'username' => 'root', 'password' => 'public', 'charset' => 'utf8', 'tablePrefix' => 'tm_', ), 'errorHandler' => array( 'errorAction' => 'site/error',//默认的错误处理action ), 'log' => array( 'class' => 'CLogRouter', 'routes' => array( array( 'class' => 'CFileLogRoute', 'levels' => 'error, warning', ), ), ), ), 'params' => array( // 自定义变量 'adminEmail' => 'webmaster@example.com ), );