如何使用PHP强制下载文件我想要求在使用PHP访问网页的用户上下载一个文件。我想这和file_get_contents,但不知道如何执行。$url = "http://example.com/go.exe";下载文件之后,header(location)它不会重定向到另一个页面。就这样停了下来。
3 回答
![?](http://img1.sycdn.imooc.com/54584cde0001d19202200220-100-100.jpg)
万千封印
TA贡献1891条经验 获得超3个赞
header("Content-Type: application/octet-stream");header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"file.exe\""); echo readfile($url);
header("Location: $url");
- 3 回答
- 0 关注
- 765 浏览
添加回答
举报
0/150
提交
取消