php怎样替换css文件中相应的内容?
color.css中的代码如下:body{background-color:#BFE7A4}
a{color:#EA605D}
a:hover{color:#300018}
.page{background-color:#472034}
.head{background-color:#E45AA1}
.body{background-color:#9D0400}
.foot{background-color:#EAA8A7}
.menu a,.menu a:visited{color:#95E75B}
.menu li li{background-color:#344C22}
.menu li li li{background-color:#153300}
.menu li:hover, .menu li.sfHover, .menu A:focus, .menu A:hover, .menu A:active{background-color:#3A8B00}
.mod{background-color:white}
.hd{background-color:#3A0100}
.hd{color:#562827}
.bd{background-color:white}
.bo,.tabControl a,.bd{border-color:#810042}
.typename{color:#EA605D}
.typename:hover{color:#300018}
.title{color:#472034}
.title:hover{color:#E45AA1}
.pubdate{color:#E45AA1}
.writer{color:#9D0400}
.description{color:#EAA8A7}
<?php
$color_array= array(".body{color:#333333}",".page{background-color:green}","div{boder-color:#666666}");
$css_file=file_get_contents("color.css");
//怎么得到
$color_rex=array("/.body\{.*\}/g","/.page\{.*\}/g","/div\{.*\}/g");
//然后替换color.css文件中的相应部分生更新css文件?
$css_file_r=preg_replace($color_rex,$color_array,$css_file);
file_put_contents("color.css",$css_file_r);
?>