如何修改文件config.php或者加载自定义的配置文件
答案:2 悬赏:40
解决时间 2021-04-27 12:46
- 提问者网友:长安小才冯
- 2021-04-27 05:57
如何修改文件config.php或者加载自定义的配置文件
最佳答案
- 二级知识专家网友:统治我的世界
- 2021-04-27 06:22
下面我的自定义的配置文件,请参考:(包含两个内容,1是数据库的配置;2.Smarty的配置)
$db_host = "localhost";
$db_user = "root";
$db_pwd = "wuji1234";
$db_database = "test1";
$conn = "PHP100";
$coding = "GBK";
//define(ALL_PS,"PHP100");
//=================
$smarty_template_dir ='./templates/';
$smarty_complie_dir ='./templates_c/';
$smarty_config_dir ='./configs/';
$smarty_cache_dir ='./cache/';
$smarty_caching = FALSE;
$smarty_delimiter =explode("|","{|}");
?>
$db_host = "localhost";
$db_user = "root";
$db_pwd = "wuji1234";
$db_database = "test1";
$conn = "PHP100";
$coding = "GBK";
//define(ALL_PS,"PHP100");
//=================
$smarty_template_dir ='./templates/';
$smarty_complie_dir ='./templates_c/';
$smarty_config_dir ='./configs/';
$smarty_cache_dir ='./cache/';
$smarty_caching = FALSE;
$smarty_delimiter =explode("|","{|}");
?>
全部回答
- 1楼网友:输掉的尊严
- 2021-04-27 07:18
按这样修改就可以了:
public目录下的自定义配置文件siteconfig.inc.php,用如下代码:
'配置值'
// 添加数据库配置信息
'username' => 'admin',
'db_type' => 'mysql', // 数据库类型
'db_host' => '127.0.0.1', // 服务器地址
'db_name' => 'detectinfo', // 数据库名
//'db_user' => 'root', // 用户名
//'db_pwd' => '', // 密码
'db_port' => '', // 端口
'db_prefix' => '', // 数据库表前缀
);
return array_merge($config,$siteconfig);
?>
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯