//图片地址处理 function Getpics($body) { global $weburl; //$body = strtolower($body); $img_array = array(); preg_match_all("/(src|SRC)=[\\"|'| ]{0,}((http|HTTP):\\/\\/(.*)\\.(gif|jpg|GIF|JPG|png))/isU",$body,$img_array); $img_array = array_unique($img_array[2]); foreach($img_array as $key=>$value) { $url = $value; $fileurl = "/pic.php?s=".base64_encode($url); $body = str_replace($url,$fileurl,$body); } return $body; } //该片段来自于http://yuncode.net