php自动缓存图标
自动下载
$url = @$_GET['url'];
stream_context_set_default( [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
$api1 = "https://favicon.zhusl.com/ico?url="; //获取站点图标接口api
if($url){
if(is_file('./cache/'.$url.'.png')){
header("Content-Type:text/html;charset=utf-8");
echo '文件已存在!';
}else{
$fav = $iconapi.$url;
$fileCon = file_get_contents($fav);
$localPath = "./cache/".$url.".png";
file_put_contents($localPath,$fileCon);
/* echo filesize($localPath); */
die($fileCon);
}
} else{
header("Content-Type:text/html;charset=utf-8");
echo '哈哈哈';
}
暂无评论