在 php 中使用 CURL 下载文件夹
Download a folder using CURL in php
所以我使用 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?
请帮帮我!!!提前致谢
您可以使用 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";
}
?>
所以我使用 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? 请帮帮我!!!提前致谢
您可以使用 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";
}
?>