• <legend id='COxpD'><style id='COxpD'><dir id='COxpD'><q id='COxpD'></q></dir></style></legend>
      <bdo id='COxpD'></bdo><ul id='COxpD'></ul>
  • <tfoot id='COxpD'></tfoot>

      1. <small id='COxpD'></small><noframes id='COxpD'>

        <i id='COxpD'><tr id='COxpD'><dt id='COxpD'><q id='COxpD'><span id='COxpD'><b id='COxpD'><form id='COxpD'><ins id='COxpD'></ins><ul id='COxpD'></ul><sub id='COxpD'></sub></form><legend id='COxpD'></legend><bdo id='COxpD'><pre id='COxpD'><center id='COxpD'></center></pre></bdo></b><th id='COxpD'></th></span></q></dt></tr></i><div id='COxpD'><tfoot id='COxpD'></tfoot><dl id='COxpD'><fieldset id='COxpD'></fieldset></dl></div>

        需要php脚本下载远程服务器上的文件并保存到本地

        时间:2023-08-20
              <i id='wXUlZ'><tr id='wXUlZ'><dt id='wXUlZ'><q id='wXUlZ'><span id='wXUlZ'><b id='wXUlZ'><form id='wXUlZ'><ins id='wXUlZ'></ins><ul id='wXUlZ'></ul><sub id='wXUlZ'></sub></form><legend id='wXUlZ'></legend><bdo id='wXUlZ'><pre id='wXUlZ'><center id='wXUlZ'></center></pre></bdo></b><th id='wXUlZ'></th></span></q></dt></tr></i><div id='wXUlZ'><tfoot id='wXUlZ'></tfoot><dl id='wXUlZ'><fieldset id='wXUlZ'></fieldset></dl></div>

            1. <tfoot id='wXUlZ'></tfoot>
              • <small id='wXUlZ'></small><noframes id='wXUlZ'>

                  <bdo id='wXUlZ'></bdo><ul id='wXUlZ'></ul>
                    <tbody id='wXUlZ'></tbody>

                • <legend id='wXUlZ'><style id='wXUlZ'><dir id='wXUlZ'><q id='wXUlZ'></q></dir></style></legend>

                • 本文介绍了需要php脚本下载远程服务器上的文件并保存到本地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  尝试在远程服务器上下载文件并将其保存到本地子目录.

                  Trying to download a file on a remote server and save it to a local subdirectory.

                  以下代码似乎适用于小文件,<1MB,但较大的文件会超时,甚至无法开始下载.

                  The following code seems to work for small files, < 1MB, but larger files just time out and don't even begin to download.

                  <?php
                  
                   $source = "http://someurl.com/afile.zip";
                   $destination = "/asubfolder/afile.zip";
                  
                   $data = file_get_contents($source);
                   $file = fopen($destination, "w+");
                   fputs($file, $data);
                   fclose($file);
                  
                  ?>
                  

                  关于如何不间断地下载较大文件的任何建议?

                  Any suggestions on how to download larger files without interruption?

                  推荐答案

                  $ch = curl_init();
                  $source = "http://someurl.com/afile.zip";
                  curl_setopt($ch, CURLOPT_URL, $source);
                  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                  $data = curl_exec ($ch);
                  curl_close ($ch);
                  
                  $destination = "/asubfolder/afile.zip";
                  $file = fopen($destination, "w+");
                  fputs($file, $data);
                  fclose($file);
                  

                  这篇关于需要php脚本下载远程服务器上的文件并保存到本地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何密码保护网站中可下载的pdf文件 下一篇:如何下载一个php文件而不执行它?

                  相关文章

                    <bdo id='59gWP'></bdo><ul id='59gWP'></ul>
                  <i id='59gWP'><tr id='59gWP'><dt id='59gWP'><q id='59gWP'><span id='59gWP'><b id='59gWP'><form id='59gWP'><ins id='59gWP'></ins><ul id='59gWP'></ul><sub id='59gWP'></sub></form><legend id='59gWP'></legend><bdo id='59gWP'><pre id='59gWP'><center id='59gWP'></center></pre></bdo></b><th id='59gWP'></th></span></q></dt></tr></i><div id='59gWP'><tfoot id='59gWP'></tfoot><dl id='59gWP'><fieldset id='59gWP'></fieldset></dl></div>
                  <legend id='59gWP'><style id='59gWP'><dir id='59gWP'><q id='59gWP'></q></dir></style></legend><tfoot id='59gWP'></tfoot>

                    1. <small id='59gWP'></small><noframes id='59gWP'>