php preg_match 匹配采集的标签

例子

<img src="http://qiniu.jinfangji.com/uploads/ueditor/php/upload/image/20180529/1527585179779262.png" title="1527585179779262.png" alt="image.png"/>


我要获取src的链接如何匹配

preg_match('/<img src="(.*)" title="(.*)" .*>/i', $uncontent, $arr);

(.*)代表取数据

  .*     代表不要

小记:

匹配时每个参数都不能掉了,不然就匹配不出来

自己的坑

preg_match('/<img src="(.*)" title="(.*)" >/i', $uncontent, $arr);


错在哪儿看到没


猜你喜欢

转载自blog.csdn.net/qq_38363371/article/details/80499690