//正则匹配获取HTML图片地址
preg_match_all('/<img.*?src="(.*?)".*?>/is', $str, $array); if (isset($array[1])) { foreach ($array[1] as $kk => $kv) { $str = str_replace($kv, str_replace(' ', '', $kv), $str); } }
$data = array();
//正则匹配获取HTML内容 preg_match_all('/<[^>]+[^<>]*[^<]*/', $text_value, $m); if (isset($m[0]) && !empty($m[0])) { foreach ($m[0] as $k => $v) { if (!empty(trim(strip_tags($v)))) { $data[] = trim(strip_tags($v, '<strong>,<span>')); } } } return $data;