代码如下 | 复制代码 |
<?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 ) |
时间: 2024-10-31 06:19:28