Home > Backend Development > PHP Tutorial > preg_match取值有关问题

preg_match取值有关问题

WBOY
Release: 2016-06-13 13:31:14
Original
948 people have browsed it

preg_match取值问题
$body= preg_match取值有关问题  preg_match取值有关问题 ;

preg_match('//i', $body, $match);
这样取得的是最后一个src,不是第一个

$body= preg_match取值有关问题
 preg_match取值有关问题 ;
图片间加
后就没问题,怎么回事


------解决方案--------------------
问题在于.+,你用了很多贪婪匹配,自然会匹配到最后面的img,可以? U去修饰
------解决方案--------------------
preg_match('//i', $body, $match);

你的范围没限死。.+ 范围太广了。又没有限制贪婪匹配。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template