jae-jae / QueryList

:spider: The progressive PHP crawler framework! 优雅的渐进式PHP采集框架。
https://querylist.cc
2.65k stars 441 forks source link

如何直接按图片地址把图片下载到本地呢? #59

Closed amhoho closed 3 years ago

amhoho commented 5 years ago

比如

$QueryList = QueryList::get('https://github.githubassets.com/images/icons/ie-notice.png');
//用$QueryList->getHtml();file_put_contents吗?
jfcherng commented 5 years ago
require __DIR__ . '/../vendor/autoload.php';

$output = __DIR__ . '/output.png';
$url = 'https://github.githubassets.com/images/icons/ie-notice.png';

file_put_contents($output, QL\QueryList::get($url)->getHtml());

// 或
file_put_contents($output, file_get_contents($url));