具體實現方法如下:
代碼如下:
<?php
header("Content-type:text/html;charset=utf-8");
$str = '<p><img src="images/11111111.jpg" alt="美女" /></p>';
$pattern = "/[img|IMG].*?src=['|"](.*?(?:[.gif|.jpg]))['|"].*?[/]?>/";
preg_match_all($pattern,$str,$match);
echo "<pre/>";
print_r($match);
?>