作者kiey (炼)
看板PHP
标题[请益] 下载zip 变成 zip.html
时间Tue May 5 13:03:29 2015
用了下面这段 code 下载後
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/zip");
$header="Content-Disposition: attachment; filename=".$zipFileName.";";
header($header );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".$len);
@readfile($zipFileName);
chrome 正常是 .zip
可是 safari 却变成 .zip.html
不知道各位先进是否有遇到过这问题?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.175.240.8
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/PHP/M.1430802212.A.429.html
1F:推 GALINE: 中间的「$header=」...不是「header()」? 05/06 12:45
2F:→ KawasumiMai: 楼上,应该是可以,因为下一行是header($header); 05/06 13:27
3F:→ KawasumiMai: 虽然有点多此一举... 05/06 13:27
4F:→ kiey: 後来有修正了 , 不过这似乎不是zip 变成 zip.html 原因 05/07 11:06
5F:→ kiey: 依然找不到原因中~"~ 05/07 11:06