preg_match_all(‘/<img[^>]*src=(\‘|\")(.*?)\\1[^>]*>/i‘,$goodsD[‘content‘],$match); //正则获取图片路径
获取到结果为:
array (size=3)
0 =>
array (size=2)
0 => string ‘<img src="/upload/image/20140724/20140724130444_45847.jpg" />‘ (length=68)
1 => string ‘<img src="/upload/image/20140724/20140724130453_44580.jpg" />‘ (length=68)
1 =>
array (size=2)
0 => string ‘"‘ (length=1)
1 => string ‘"‘ (length=1)
2 =>
array (size=2)
0 => string ‘/upload/image/20140724/20140724130444_45847.jpg‘ (length=47)
1 => string ‘/upload/image/20140724/20140724130453_44580.jpg‘ (length=47)
0:完整图片 2:图片路径
时间: 2024-12-17 23:30:54