龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php 读写数组类型配置文件

时间:2014-07-08 15:08来源:网络整理 作者:网络 点击:
分享到:
读写数组类型配置文件 [代码片段(14行)]
// 写入配置文件的变量
public static function rewriteConfig($key, $value) {
    $path = app_path() . '/storage/Config.php';
    $contents = file_get_contents($path);
    $contents = str_replace(self::loadConfig($key), $value, $contents);
    file_put_contents($path, $contents);
}

// 读取配置文件的变量
public static function loadConfig($key) {
    $Config = require(app_path() . '/storage/Config.php');
    return $Congig[$key];
}
//该片段来自于http://outofmemory.cn
精彩图集

赞助商链接