【发布时间】:2014-11-27 06:16:30
【问题描述】:
例如
$string =
'aaaaaaasssssshttp://www.1.com/images/001/001/001/1.jpgddwxeaaaaaa
crewcwehttp://www.2.com/images/002/002/002/2.jpgrcegcger
cgwcgrewhttp://www.3.com/images/003/003/003/3.jpgcgergcer
cerggewrcgrewhttp://www.4.com/images/004/004/004/4.jpgecgewrcgerwcg
cerghttp://www.5.com/images/005/005/005/5.jpg';
我想得到第一个图像完整的网址,就像这样:
"http://www.1.com/images/001/001/001/1.jpg"
我使用了这个功能,但它不起作用
if (preg_match_all('^http:\/\/\.(png|jpeg|jpg|gif|bmp)$/i', $string, $matches))
print_r ($matches[1]);
谁能帮帮我?非常感谢!
【问题讨论】:
标签: php regex image preg-match-all