php 取图片正则表达式

$str='<img src=xxxxx  alt=""/>';

$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";

preg_match_all($pattern,$str,$match);

//print_r($match);
return next($match) ;
//0, 带img 标签
//1 ,直接是url
posted @ 2015-08-10 10:13  望远近  阅读(507)  评论(0编辑  收藏  举报