php正则提取html img src地址
<?php
$str='<img border="0" src="1.jpg" alt=""/><img border="0" src="a.jpg" alt=""/><img src="test.jpg" />';
$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern,$str,$match);
//print_r($match[1]);
print_r($match);
preg_match('/<img.+src=\"?(.+\.(jpg|gif|bmp|bnp|png))\"?.+>/i', stripcslashes($_POST['content']), $match);
$litpic = $match[1];
?>
个人作品展示:www.jinyuanbao.cn
浙公网安备 33010602011771号