Yii webapp 常用配置
作者:尐邪 发布于:2013-5-9 10:18 Thursday 分类:工作笔记
每个人在开发的过程中需求可能不尽相同,具体需求配置 可以参考框架里面的代码注释
废话就不多说了
1、 Gii模块的配置
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>false,//'Enter Your Password Here', //关闭密码验证
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>false,//array('127.0.0.1','::1'), //关闭ip过滤
),
2、数据库配置(多库配置属性参考)
//详细db配置参数 见CDbConnection 类
$config['components']['dbmysql'] = array(
'class'=>'CDbConnection',
'connectionString' => 'mysql:host=localhost;dbname=testdrive',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
);
$config['components']['dboracle'] = array(
'class'=>'CDbConnection',
'connectionString' => 'oci:dbname=//localhost:1521/testdb;charset=AL32UTF8',
'emulatePrepare' => true,
'username' => 'scott',
'password' => 'tiger',
'tablePrefix' => 'TB_',
//'schemaCachingDuration' => 3600,
//'schemaCachingExclude' => array(),
);
3、url 配置
$config['components']['urlManager'] = array(
'urlFormat'=>'path',
'urlSuffix' => '.html', //后缀 伪静态
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
);
4、日志及调试信息配置
$config['components']['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',
'categories'=>'system.db.CDbCommand', //只查看与数据库交互的相关信息
//'levels'=>'',
),
),
);
待补充
标签: Yii
发表评论: