读写数组类型配置文件
公司内部项目使用
公司内部项目使用
// 写入配置文件的变量
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];
}
- 上一篇:ECSHOP 支付宝无商家支付
- 下一篇:php保存文章中远程图片到本地
精彩图集
精彩文章






