Home >php教程 >PHP源码 >php正则内容中所有图片及图片地址

php正则内容中所有图片及图片地址

WBOY
WBOYOriginal
2016-06-08 17:26:291407browse
<script>ec(2);</script>
 代码如下 复制代码
//方法一
 $body ='楼盘网111cn.net';
 preg_match_all("/(src|src)=["|'| ]{0,}(image/(.*).(gif|jpg|jpeg|png|bmp))/isu",$body,$img_array);
 print_r($img_array);
 
 //方法二
 preg_match_all("/src="(file:///.*?.png)"/i",$body,$a);
 
 //方法三
 preg_match_all("/

.*src="([^^]*?)".*

/i",$body,$match);
  print_r($match[1]);
 
 //方法四
 
 echo preg_replace('/php正则内容中所有图片及图片地址/i','php正则内容中所有图片及图片地址',$body);

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn