Home >Backend Development >PHP Tutorial >IMG_URL地址获取,正则解决思路

IMG_URL地址获取,正则解决思路

WBOY
WBOYOriginal
2016-06-13 11:51:481131browse

IMG_URL地址获取,正则
大家。我请教一下,我怎么取到这里面的img地址:我想取得www.baidu.com

IMG_URL地址获取,正则解决思路


------解决方案--------------------
引用:
Quote: 引用:

$str = '<div class="float_l"><img  src="www.baidu.com"   style="max-width:90%" class="linkImg" link=abc" / alt="IMG_URL地址获取,正则解决思路" ></div>';<br />preg_match("/<img  src=\"([^\"]+)\"/i", $str,$match);<br / alt="IMG_URL地址获取,正则解决思路" >var_dump($match[1]);
如何把div也包含在里面??因为我页面上有很多的图片。。但是我只想取这个层里面的图片

IMG_URL地址获取,正则解决思路
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