最近在了解Yii框架,还是一头雾水。
Yii配置文件比ThinkPHP复杂多了,先把自己了解的配置记录下来,免得忘记了 呵呵,也给大家参考下。
代码如下
// 主配置文件
$config = array(
"modules" => array(
"gii" => array(
"class" => "system.gii.GiiModule",
"password" => "admin",
),
),
"basePath" => dirname(__FILE__) . DIRECTORY_SEPARATOR . "..",
"name" => "Yii学习", //项目名称
"preload" => array("log"),
"import" => array(//自动加载类
"application.models.*",
"application.components.*",
),
"defaultController" => "index", //默认控制器
"layout" => "layout", //layout文件
"components" => array(
"db" => array(//数据库配置
"connectionString" => "mysql:host=localhost;dbname=h.me",
"username" => "root",
"password" => "",
"charset" => "utf8",
"tablePrefix" => "tp_",
"enableParamLogging" => true, //显示带参数的SQL
),
"urlManager" => array(
"urlFormat" => "path", //pathinfo模式
"showScriptName" => false, //隐藏index.php时需要设置false
// "urlSuffix" => ".html", //url后缀相当于伪静态
),
"errorHandler" => array(
"errorAction" => "index/error", //404错误跳转到所在方法
),
"log" => array(//日志
"class" => "CLogRouter",
"routes" => array(
array(
"class" => "CWebLogRoute",
"levels" => "trace,error,waring", //Application Log 显示级别
"categories" => "system.*", //记录类别
),
),
),
),
"params" => require(dirname(__FILE__) . "/params.php"),
);
return $config;
?>
http://m.bbyears.com/jiaocheng/45539.html
推荐访问: