php强制下载头文件
哪些标题对强制下载最重要,哪些标题由浏览器自动填充 例如php强制下载头文件,php,download,http-headers,media,Php,Download,Http Headers,Media,哪些标题对强制下载最重要,哪些标题由浏览器自动填充 例如 header('Content-Description: File Transfer'); header('Content-type: application/zip'); header('Content-Length: '.sprintf("%u", filesize($zip_out))); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); heade
header('Content-Description: File Transfer');
header('Content-type: application/zip');
header('Content-Length: '.sprintf("%u", filesize($zip_out)));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Disposition: attachment; filename="'.basename($zip_out).'"');
我省略了除第1行和第2行之外的所有标题,下载工作正常为什么/如何???
内容处置:附件
表示您的浏览器内容是附件。因此,浏览器将开始以文件形式下载内容
根据:
如果处置类型与“附件”匹配(不区分大小写),
这表示收件人应提示用户保存
本地响应,而不是正常处理(根据其介质
类型)
Content-type:application/zip
表示您的浏览器已压缩内容,并且通常使浏览器将内容作为文件下载,即使省略了Content-Disposition:attachment
,因为这是浏览器对压缩内容的默认行为
我从未在任何HTTP相关规范中看到过内容描述
标题,我认为它根本不会影响下载