php 更新配置文件

$config_file="路径";
        if(file_exists($config_file)){
            $configs=include $config_file;
        }else {
            $configs=array();
        }
        $configs=array_merge($configs,$data);
        $result = file_put_contents($config_file, "<?php\treturn " . var_export($configs, true) . ";");

  此方法与上一篇http://www.cnblogs.com/qinmei/p/6903333.html最后的结果都一样

posted @ 2017-05-25 14:01  *琴  阅读(75)  评论(0)    收藏  举报