Posted in PHP onNovember 12, 2011
<?php $str='<p><img border="0" src="upfiles/2009/07/1246430143_1.jpg" alt=""/></p>'; $pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/"; preg_match_all($pattern,$str,$match); print_r($match); ?>
结果显示:
Array
(
[0] => Array
(
[0] => <img border="0" src="upfiles/2009/07/1246430143_1.jpg" alt=""/>
)
[1] => Array
(
[0] => upfiles/2009/07/1246430143_1.jpg
)
)
PHP提取字符串中的图片地址[正则表达式]
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@