php正则匹配获取img标签src内容-多个

//正则匹配获取img标签src内容-多个
function get_imgAllSrc($tag) {
// print_r($tag);die;

preg_match_all('/(id|alt|title|src)=("[^"]*")/i', $tag, $matches);

$ret = array();
foreach($matches[0] as $i => $v) {
$ret[] = trim($matches[2][$i],'"');

}

return $ret;
}

参考链接:https://blog.csdn.net/qq_27270307/article/details/90702259

猜你喜欢

转载自www.cnblogs.com/heanwanfeng/p/11685719.html
今日推荐