如何修改文件config.php或者加载自定义的配置文件

浏览:10375 发布日期:2014/10/01 分类:求助交流
如何将对config.php里的配置参数的修改写入到该文件中而不是写入缓存呢?或者我想在config.php中加载我放在public目录下的自定义配置文件siteconfig.inc.php,用如下代码:<?php
$siteconfig = require '__PUBLIC__/siteconfig.inc.php';
$config = array(
    //'配置项'=>'配置值'
    // 添加数据库配置信息
    '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);
?>
但是require函数会报错ERROR:require(): Failed opening required '__PUBLIC__/siteconfig.inc.php' (include_path='.;C:\php\pear;C:\wamp\www\ThinkPHP/Extend/Vendor/') in C:\wamp\www\PluginDetect\Conf\config.php on line 2求帮忙解决这个路径问题,或者大家告诉我怎么可以取得config.php的路径?
非常感谢!
最佳答案
评论( 相关
后面还有条评论,点击查看>>