php正则抓取图片(抓取图片403处理)
<?php //抓取页面图片的时候防止图片403(防止盗链) echo "<meta name='referrer' content='no-referrer'>"; $list = file_get_contents($url); $k = preg_match_all('/<img [^>]* \/>/',$list,$data); $m = preg_grep('/alt/',$data[0]); foreach($m as $v){ echo $v.'<br>'; }