http response

关键词:http response header 下载文件

案例1:

访问某个链接,然后下载文件,需要特定的http头:

header("Content-Type:application/zip;");
header("Content-Disposition: attachment; filename=tmp.txt");

content-type表明是什么类型的文件,zip表示是zip类型的

content-disposition这个选项固定为attachment,我也不清楚是啥意思

filename是下载时保存用的文件名

附:shell下的zip命令:http://www.blogjava.net/cpegtop/articles/382714.html

原文地址:https://www.cnblogs.com/helww/p/4076362.html