如何使用 php 从 aws s3 存储桶下载对象并将其保存到本地计算机而不是服务器上?
当我使用该代码时,它会在我的网站运行的服务器上下载文件。如何将其下载到我的本地计算机。
public function download($bucketName,$folderName)
{
try {
$source = $bucketName.'/'.$folder;
$dest = 'C:/sync/download/'.$folder;
$manager = new \Aws\S3\Transfer($this->s3, $source, $dest);
$manager->transfer();
return $manager;
//return true;
} catch (Aws\S3\Exception\S3Exception $e) {
//echo "There was an error downloading the file.";
return $e;
}
}
The problem with that code when I am using it will download files on my server where my website is running. How can I download it to my local computer.
public function download($bucketName,$folderName)
{
try {
$source = $bucketName.'/'.$folder;
$dest = 'C:/sync/download/'.$folder;
$manager = new \Aws\S3\Transfer($this->s3, $source, $dest);
$manager->transfer();
return $manager;
//return true;
} catch (Aws\S3\Exception\S3Exception $e) {
//echo "There was an error downloading the file.";
return $e;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论