正则获取到的图片数组
<?php
$url = 'D:/xampp/htdocs/bihuo_05/PHP_07/Lesson_Code/shop_web/index.html';
$res = file_get_contents($url);
$reg = '/<A href="#".*?><IMG.*?src="(.*?)".*?><\/A>/s';
preg_match_all($reg, $res, $arr);
`mkdir image`
;
foreach($arr[1] as $k => $v):
$nurl = 'D:/xampp/htdocs/bihuo_05/PHP_07/Lesson_Code/shop_web/'.$v;
$rs = file_get_contents($nurl);
file_put_contents($v, $rs);
endforeach;
转载请注明原文地址:https://tech.qufami.com/read-16776.html