知识屋:更实用的电脑技术知识网站
所在位置:首页 > 编程技术  > PHP编程

Yii学习(2)----主配置文件

发表时间:2014-09-05来源:网络

 <?php    // uncomment the following to define a path alias  // Yii::setPathOfAlias('local','path/to/local-folder');    // This is the main Web application configuration. Any writable  // CWebApplication properties can be configured here.  return array(      'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',//当前应用根目录的绝对物理路径      'name'=>'Ge Yii Test Study!',//当前应用的名称        // preloading 'log' component      'preload'=>array('log'),//与载入log(记录)组件,无论什么情况都会被创建        // autoloading model and component classes      'import'=>array(          'application.models.*',//载入application/models/文件夹下的所有模型类          'application.components.*',//载入application/components/文件夹下的所有应用组件类      ),        'defaultController'=>'site',//设置默认控制器类            'modules'=>array(          // uncomment the following to enable the Gii tool          /*         'gii'=>array(             'class'=>'system.gii.GiiModule',             'password'=>'Enter Your Password Here',             // If removed, Gii defaults to localhost only. Edit carefully to taste.             'ipFilters'=>array('127.0.0.1','::1'),         ),         */      ),        // application components      //当前应用的组件配置。更多可供配置的组件详见下面的"核心应用组件"      'components'=>array(          'user'=>array(//用户组件配置,user为组件ID              // enable cookie-based authentication(可基于cookie的认证)                       'allowAutoLogin'=>true,          ),                    'cache'=>array( //缓存组件              'class'=>'CMemCache', //缓存组件类              'servers'=>array( //MemCache 缓存服务器配置                              array('host'=>'server1', 'port'=>11211, 'weight'=>60), //缓存服务器1                              array('host'=>'server2', 'port'=>11211, 'weight'=>40), //缓存服务器2              ),          ),                          // uncomment the following to enable URLs in path-format          /*         'urlManager'=>array(//URL路由管理器             'urlFormat'=>'path',             //共支持两种格式: 'path' 格式( 如:/path/to/EntryScript.php/name1/value1/name2/value2... ) 和'get' 格式( //如:/path/to/EntryScript.php?name1=value1&name2=value2...)。当使用'path'格式时,需要设置如下的规则:             'rules'=>array(                 '<controller:/w+>/<id:/d+>'=>'<controller>/view',                 '<controller:/w+>/<action:/w+>/<id:/d+>'=>'<controller>/<action>',                 '<controller:/w+>/<action:/w+>'=>'<controller>/<action>',             ),         ),         */          'db'=>array(              'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',          ),          // uncomment the following to use a MySQL database          /*         'db'=>array(             'connectionString' => 'mysql:host=localhost;dbname=testdrive',             'emulatePrepare' => true,             'username' => 'root',             'password' => '',             'charset' => 'utf8',             'tablePrefix =>'tbl_',         ),         */          'errorHandler'=>array(              // use 'site/error' action to display errors              // 使用SiteController 控制器类中的actionError 方法显示错误              'errorAction'=>'site/error',          ),          'log'=>array(//处理记录信息的类              'class'=>'CLogRouter',              'routes'=>array(                  array(                      'class'=>'CFileLogRoute',//处理错误信息的类                      'levels'=>'error, warning',//错误等级                  ),                  // uncomment the following to show log messages on web pages                  /*                 array(                     'class'=>'CWebLogRoute',//将错误记录消息在网页上显示                 ),                 */              ),          ),      ),//应用组件配置结束        // application-level parameters that can be accessed      // using Yii::app()->params['paramName']      //使用Yii::app()->params['参数名']可以访问应用层的参数      'params'=>array(          // this is used in contact page          'adminEmail'=>'webmaster@example.com',      ),  );  

 

(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜