码迷,mamicode.com
首页 > 其他好文 > 详细

正则匹配图片图片图片地址

时间:2015-09-24 10:44:28      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:

 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:图片路径

正则匹配图片图片图片地址

标签:

原文地址:http://www.cnblogs.com/xiamibk/p/4834357.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!