/**
 * 替换文章内容的图片
 */
function replace_img($content){
	$domain = 'http://'.$_SERVER['SERVER_NAME'];
	preg_match_all("/<(.*)(src=\"[^\"]+\")[^>]+>/isU", $content, $match);
	foreach($match[2] as $img){
		$content = str_replace($img, 'src="'.$domain.substr($img,5),$content);
	}
	return $content;
}

Post Navigation