首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何下载安全镜像

如何下载安全镜像
EN

Stack Overflow用户
提问于 2018-07-19 13:19:36
回答 0查看 30关注 0票数 1

我正在尝试下载一个安全的图像,我可以下载除以下链接以外的其他图像。

https://store.bbcomcdn.com/images/store/skuimage/sku_EVL4900077/image_skuEVL4900077_largeImage_X_450_white.jpg

下面是我的代码:

代码语言:javascript
复制
<?php
    function downloadFile ($url, $path) {

  $newfname = $path;
  $file = fopen ($url, "rb");
  if ($file) {
    $newf = fopen ($newfname, "wb");

    if ($newf)
    while(!feof($file)) {
      fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
    }
  }

  if ($file) {
    fclose($file);
  }

  if ($newf) {
    fclose($newf);
  }
 }

downloadFile ("https://store.bbcomcdn.com/images/store/skuimage/sku_EVL4900077/image_skuEVL4900077_largeImage_X_450_white.jpg", "name.jpg");
?>
EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51414845

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档