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; }
千行代码,Bug何处藏。 纵使上线又怎样,朝令改,夕断肠。