如何使用PHP下载zip文件?

时间:2017-04-01 06:31:48

标签: php html download zip

我想下载google drive上传的zip文件。以下是我的html代码供下载,

 <a class="tlClogo" href="https://drive.google.com/open?id=0BzJrMJ44NPAEV1ZIRmk4VTdxbG8" id="downloadThisPage"  oncontextmenu="return false;" download="myzip.zip"/>Click Here to download</a>

这是javascript,

<script type="text/javascript">
document.getElementById("downloadThisPage").href = window.location.toString();
</script>

1 个答案:

答案 0 :(得分:0)

无需使用javascript anchor标签即可完成工作。你只需要改变这样的链接。

FROM:

<a class="tlClogo" href="https://drive.google.com/open?id=0BzJrMJ44NPAEV1ZIRmk4VTdxbG8" id="downloadThisPage"  oncontextmenu="return false;" download="myzip.zip"/>Click Here to download</a>
   

TO:

<a class="tlClogo" href="https://drive.google.com/uc?export=download&confirm=SYSo&id=0BzJrMJ44NPAEV1ZIRmk4VTdxbG8">Click Here to download</a>