php - pCloud 您的下载已过期。再次尝试上一步
问题描述
我使用 pcloud 基础架构让用户在我们的网站上上传文件。
但是我在使用 api 时遇到了问题。在file.php中的下载函数中
$ fileLink = $ this-> getLink ($ fileId);
我们正在使用。但过了一会儿,用户说“您的下载已过期。再试一次上一步。” 给出一个错误。我想知道有没有办法解决这个问题?我想要无限下载时间。谢谢你的帮助
API Github:http: //github.com/pCloud/pcloud-sdk-php/
解决方案
我找到了答案。
您必须在返回行之前在下载功能上添加此代码;
header('Content-Description: Description');
header('Content-Type: application/x-zip-compressed');
header('Content-Disposition: attachment; filename='.basename($path));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($path));
fclose($file);
fclose($source);
readfile($path);
推荐阅读
- reactjs - 如何在 React 中对 Office UI Fabric 表单进行无浏览器测试
- c# - 将带有GMT的字符串中的DateTime转换为C#中的本地时间
- java - Hbase中的Apache Phoenix日期字段查询
- sql-server - 返回表单后 DataCombo 未刷新
- maven - 如何将 pom 设置为 maven 插件中的默认工件?
- php - Cakephp 3.6:从表单获取数据 - 奇怪的解决方法
- asp.net - targetFramework-Attribute... 更高版本 4
- asp.net-core-2.1 - .net core 2.1 基于声明的身份验证
- xml - 基于元素值(包括子实体)组合 XML 消息
- haskell - haskell - 无法将类型“(Char,Int)”与“[Char]”错误匹配