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

读写数组类型配置文件

时间:2014-07-22 14:49来源: 作者: 点击:
分享到:
公司内部项目使用
公司内部项目使用
// 写入配置文件的变量
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];
}
精彩图集

赞助商链接