Yii学习(2)----主配置文件
2013-11-21 15:29
429 查看
<?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', ), );
相关文章推荐
- Yii PHP Framework实用入门教程(详细介绍)
- 在yii中新增一个用户验证的方法详解
- 浅析Yii中使用RBAC的完全指南(用户角色权限控制)
- 解析yii数据库的增删查改
- Yii 快速,安全,专业的PHP框架
- 表单(Form)的使用(3)——窗口构造器
- 数据库之DAO
- 数据库之变迁
- Yii-You are not allowed to access this page
- 如何让Yii框架支持多个数据库
- Yii分表插件Par(Partition Active Record)[原创]
- 对于yii用 CPagination分页url解析问题
- 在YII框架中运用smarty模板引擎
- Yii一个form提交两个model数据
- yii框架下输出hive结果
- yii getInstance 返回为空的可能的原因
- Yii中components的使用
- yii cgridview 自选按钮
- yii获取当前url和域名
- Yii中配置单点登录 即多个子站同步登录。