php去除html代码中img图片标签宽高函数

  php去除html代码中img图片标签宽高函数,应对采集数据出现图片大小限制问题。

 

  

function content_strip($content){
	$content = preg_replace('/<img[^>]*src=[\'"]?([^>\'"\s]*)[\'"]?[^>]*>/ie',"wap_img('$1')",$content);
	return $content;
}
function wap_img($url){
	$img='<img src="'.$url.'">';
	return $img;
}

  

posted @ 2020-02-03 17:07  圆柱模板  阅读(665)  评论(0)    收藏  举报