#1 小双
不同用一个config.php,只同用
"db" => array( // 数据库设置
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => '',
'prefix' => '',
),
这段代码,怎么做啊?如何在$spConfig = array()里面调用上面一段代码?
2010-05-06 16:52:07
"db" => array( // 数据库设置
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => '',
'prefix' => '',
),
2010-05-06 16:52:07
$spConfig = require(APP_PATH.'/admin_config.php'); // 载入不同的config文件
$spDBConfig = require(APP_PATH.'/db_config.php'); // 载入相同的部分配置文件
$spConfig = $spConfig + $spDBConfig;
2010-05-06 17:06:31
2010-05-06 17:08:39
$spConfig = array(db_config.php里面的写法则是:
'view' => array(
'enabled' => TRUE, // 开启视图
'config' =>array(
'template_dir' => APP_PATH.'/tpl', // 模板目录
'compile_dir' => APP_PATH.'/tmp', // 编译目录
'cache_dir' => APP_PATH.'/tmp', // 缓存目录
'left_delimiter' => '<{', // smarty左限定符
'right_delimiter' => '}>', // smarty右限定符
),
'auto_display' => TRUE, // 使用自动输出模板功能
'auto_display_sep' => "_", // 自动输出模板的拼装模式,/为按目录方式拼装,_为按下划线方式,这里用下划线
),
.....
然后在入口处:
$spConfig["db"] => array( // 数据库设置
'host' => 'localhost',
'login' => 'root',
'password' => '*****',
'database' => 'dbname',
'prefix' => 'pubgb_',
);
require(APP_PATH."config.php");记得顺序要配合好,不然会出错的。
require("db_config.php");
2010-11-12 02:11:54
2011-07-22 17:11:06
2011-07-22 17:17:11
2011-07-22 17:33:36