标签:clu php pat else merge ret pfile pre key
$path=‘路径‘;//写入路径 $file=include $path; $res = array_merge($file, array(‘key‘=>$rolling)); $str = ‘<?php return array(‘; foreach ($res as $key => $value){ // ‘\‘‘ 单引号转义 //$str .= ‘\‘‘.$key.‘\‘‘.‘=>‘.‘\‘‘.$value.‘\‘‘.‘,‘; if (is_array($value)){ $str.= ‘\‘‘.$key.‘\‘‘.‘=>array(‘; foreach ($value as $k=>$v){ $str.=‘\‘‘.$k.‘\‘‘.‘=>‘.‘\‘‘.$v.‘\‘‘.‘,‘; } $str.=‘),‘; }else{ $str.=‘\‘‘.$key.‘\‘‘.‘=>‘.‘\‘‘.$value.‘\‘‘.‘,‘; } }; $str .= ‘); ‘; $upfile =file_put_contents($path, $str);//写入文件
标签:clu php pat else merge ret pfile pre key
原文地址:http://www.cnblogs.com/qinmei/p/6903333.html