Home >Backend Development >PHP Tutorial > 求一正则婚配的PHP代码

求一正则婚配的PHP代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:00:32767browse

求一正则匹配的PHP代码
http://e.hiphotos.baidu.com/baike/s%3D220/sign=6c84b182baa1cd1101b675228913c8b0/a50f4bfbfbedab6497171872f736afc379311e1e.jpg

http://h.hiphotos.baidu.com/baike/s%3D220/sign=b3f3516701e9390152028a3c4bed54f9/d058ccbf6c81800ad6f26049b13533fa828b4766.jpg

http://g.hiphotos.baidu.com/baike/s%3D220/sign=f1457cf21f30e924cba49b337c096e66/f7246b600c3387441db54e86510fd9f9d62aa0dc.jpg

把红色部分匹配出来~~
------解决方案--------------------

<?php <br />
$str = '<img class="card-image editorImg log-set-param" alt="陈晓东" src="http://e.hiphotos.baidu.com/baike/s%3D220/sign=6c84b182baa1cd1101b675228913c8b0/a50f4bfbfbedab6497171872f736afc379311e1e.jpg" title="陈晓东" log-set-param="img_view" onload="this.parentNode.parentNode.style.width=this.width+px"/>';<br />
preg_match('/<img .*\/(\w+\.jpg)"/', $str, $match);<br / alt=" 求一正则婚配的PHP代码 " >
var_dump($match[1]);<br />
?>

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