stream_context_set_default( [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
$iconapi = "https://g.csdnimg.cn/static/logo/favicon32.ico"; //获取站点图标接口api
$fileCon = file_get_contents($iconapi);
$localPath = "/7.png";
file_put_contents($localPath,$fileCon);
// echo filesize($localPath); 输出文件流
die($fileCon);
注意事项:当前文件的目录 权限一定要设置777
不然会报 如下错误failed to open stream: Permission denied in ...
暂无评论