时间:2021-07-01 10:21:17 帮助过:4人阅读
例子:
代码如下:
$con = file_get_contents("http://www.php.com/news/jb-1.html");
$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
preg_match_all($pattern,$con,$match);
print_r($match);
?>
结果:
代码如下:
Array
(
[0] => Array
(
[0] =>
[1] =>
[2] =>
)
[1] => Array
(
[0] => https://img.gxlcms.com//Uploads-s/new/2019-09-21-201921/logo.png
[1] => https://img.gxlcms.com//Uploads-s/new/2019-09-21-201921/531656480.jpg
[2] => https://img.gxlcms.com//Uploads-s/new/2019-09-21-201921/2647136297.jpg
)
)