输出结果:Array( [0] => Array ( [0] =>">
当前位置:Gxlcms > PHP教程 > phppreg_match_all匹配文章中图片

phppreg_match_all匹配文章中图片

时间:2021-07-01 10:21:17 帮助过:13人阅读

  1. $con = file_get_contents("http://bbs.it-home.org/news/jb-1.html");
  2. $pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
  3. preg_match_all($pattern,$con,$match);
  4. print_r($match);
  5. ?>

输出结果: Array ( [0] => Array ( [0] => 脚本学堂 [1] => 程序员之家上线了2 [2] => 875EA1C00E50B4542797E24FA6E7E1F2.jpg ) [1] => Array ( [0] => https://img.gxlcms.com//Uploads-s/new/2019-09-22-201922/logo.png [1] => https://img.gxlcms.com//Uploads-s/new/2019-09-22-201922/531656480.jpg [2] => https://img.gxlcms.com//Uploads-s/new/2019-09-22-201922/2647136297.jpg ) )

人气教程排行