下面的代码,可以正则提取html中的图片,并保存为数组

<?php
$str2 = '<p>678678<em>111111<img src="http://www.XXX.top/upload/image/20180709/1531139077408405.Png" title="1531139077408405.jpg" alt="平面图.jpg"/><img src="http://www.XXX.top/upload/image/20180709/1531139077408405.jpg" title="1531139077408405.jpg" alt="平面图.jpg"/><img src="http://www.XXX.top/upload/image/20180709/1531139077408405.jpg" title="1531139077408405.jpg" alt="平面图.jpg"/><img src="http://www.XXX.top/upload/image/20180709/1531139077408405.jpg" title="1531139077408405.jpg" alt="平面图.jpg"/></em></p>';
//  preg_match_all("/\"http:[\/]{2}[a-z]+[.]{1}[a-z\d\-]+[.]{1}[a-z\d]*[\/]*[A-Za-z\d]*[\/]*[A-Za-z\d]*\S*\"/",$str2,$array3);
    preg_match_all("/upload\/\w+\/\w+\/\w+.(jpg|png|jpeg|gif)/i",$str2,$array3); 
print_r($array3);