【问题标题】:Download a folder using CURL in php在 php 中使用 CURL 下载文件夹
【发布时间】:2015-08-04 10:25:52
【问题描述】:

所以我使用 curl 在服务器上上传了一个文件夹 .zip:

function uploadCurs(){
   $ch = curl_init("http://myServer.com/service.php");
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_POST, true);
   curl_setopt($ch, CUROPT_POSTFIELDS, "archive = ".NOM_OF_ARCHIVE);
   echo curl_exec($ch);
}

现在,如何测试上传是否成功以及如何下载这个 .zip? 请帮帮我!!!提前谢谢

【问题讨论】:

  • 你的问题真的不清楚你想做什么。

标签: php curl libcurl


【解决方案1】:

您可以使用 file_exists 函数。 See here for manual

你可以这样做:

<?php
    $filename = '/path/to/foo.zip';

    if (file_exists($filename)) {
        echo "The file $filename exists";
    } else {
      echo "The file $filename does not exist";
    }
?>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-17
    相关资源
    最近更新 更多