PHP清理标签属性
// code from https://www.aslibra.com/
// by hqlulu
// replace <img (any code) src="(pic url)">
// to <img src="(pic url)">
function parse_img ( $content ) {
preg_match_all ("/<img[^>]+src=\"(.+)\"[^>]*>/isU",
$content,
$out, PREG_PATTERN_ORDER);
foreach($out[1] as $k=>$v){
$content = str_replace($out[0][$k], '<img src="'.$out[1][$k].'">', $content);
}
return $content;
}