要用preg_match_all提取过滤出网页中这种类型的图片链接的正则表达式该怎么写?链接类型如下
http://5.share.photo.xuite.net/east90/150e088/5414239/208086313_c.jpg写了半天提取不出来,请高手指点一下!!
http://5.share.photo.xuite.net/east90/150e088/5414239/208086313_c.jpg写了半天提取不出来,请高手指点一下!!
解决方案 »
- 用户注册的保持
- 使用Eclipse+PDT+Xdebug调试php程序时,如何设置xdebug.var_display_max_data的值呢?
- Something went wrong - -32300 : transport error - HTTP status code was not 200
- 初学者问题,循环进行字符处理问题
- 求PHP 函数引用返回例子
- 求解答 nginx 的重写规则错误问题
- SOS:急求各位大侠,请问在php代码中怎么样将十进制(2147483649---4294967296)的数字转换为十六进制啊?用dechex()只能处理小于2147483649
- 如何抓取需要用户登录才能看的页面
- 帮忙看这段代码
- Error 404 Object not found!
- echo数组问题
- 求助php判断目录下的文件是否存在
<a href="http://photo.xuite.net/east90/5414239/2.jpg"><img src="http://5.share.photo.xuite.net/east90/150e075/5414239/208086038_c.jpg" onerror="javascript:this.src='/images/blank.gif'" border="0" class="photo_cover "></a>
<div class="photo_info">
<p class="photo_info_title"><a href="http://photo.xuite.net/east90/5414239/2.jpg">2.jpg</a></p>
</div>
</div>
<div class="photo_item inline-block">
<a href="http://photo.xuite.net/east90/5414239/3.jpg"><img src="http://5.share.photo.xuite.net/east90/150e07d/5414239/208086046_c.jpg" onerror="javascript:this.src='/images/blank.gif'" border="0" class="photo_cover "></a>
<div class="photo_info">
<p class="photo_info_title"><a href="http://photo.xuite.net/east90/5414239/3.jpg">3.jpg</a></p>
</div>
</div>
<div class="photo_item inline-block">
<a href="http://photo.xuite.net/east90/5414239/4.jpg"><img src="http://5.share.photo.xuite.net/east90/150e085/5414239/208086054_c.jpg" onerror="javascript:this.src='/images/blank.gif'" border="0" class="photo_cover "></a>
<div class="photo_info">
<p class="photo_info_title"><a href="http://photo.xuite.net/east90/5414239/4.jpg">4.jpg</a></p>
</div>
如http://img.xuite.net/_v_1.0.12/personal/photo/images/logo_photo.png
http://8.share.photo.xuite.net/event/18c543e/5077425/206219149_o.jpg
这种的不要
只要http://5.share.photo.xuite.net/east90/150e088/5414239/208086313_c.jpg
这种的
也就是只提取含有 east90 的图片地址
preg_match_all('/img src="(http\:\/\/[east90\/\.a-z0-9\_]+\.jpg|png|gif)/isU', $str, $matches);
print_r($matches[1]);
看看是不是你要的?正則我也不是很熟練..
$s=<<<html
<img src="http://5.share.photo.xuite.net/east90/150e075/5414239/208086038_c.jpg">
<img src="http://5.share.photo.xuite.net/aa65/150e075/5414239/aadsfadsfsdff.jpg">
<img src="http://5.share.photo.xuite.net/east90/150e075/5414239/bb.jpg">
html;
preg_match_all('#<img src="([^"]*(?=/east90/)[^"]*)"[^>]*>#isU',$s,$m);
print_r($m[1]);
/*
输出
Array
(
[0] => http://5.share.photo.xuite.net/east90/150e075/5414239/208086038_c.jpg
[1] => http://5.share.photo.xuite.net/east90/150e075/5414239/bb.jpg
)
*/