用正则表达式求图片字符串

<?php
$content = '<div id="mainpic"><a href="http://t.douban.com/lpic/s3984108.jpg" title="目送"><img src="http://t.douban.com/mpic/s3984108.jpg" title="点击看大图" alt="目送"></a>';
$content    =   stripslashes($content);  
preg_match_all("/<img.+src=(('|\")(.+)('|\"))/Uis",$content,$out); 
print_r($out[1]);
$content="<table   cellspacing=0   cellpadding=0>  
          <tbody>  
                  <tr>  
                          <td>  
                          <div   align='center'><img   alt=''   src='../imgs/news/051019/0936372.jpg'   />   </div>  
                          <a   href='../imgs/news/051019/0936371.jpg'>fd</a>   </td>  
                  </tr>  
          </tbody>  
  </table>   ";
$content    =   stripslashes($content);  
preg_match_all("/<img.+src=(('|\")(.+)('|\"))/Uis",$content,$out); 
print_r($out[1]);
?>

你可能感兴趣的:(用正则表达式求图片字符串)