[請益] 下載zip 變成 zip.html

看板PHP作者 (煉)時間10年前 (2015/05/05 13:03), 編輯推噓1(104)
留言5則, 3人參與, 最新討論串1/2 (看更多)
用了下面這段 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://www.ptt.cc/bbs/PHP/M.1430802212.A.429.html

05/06 12:45, , 1F
中間的「$header=」...不是「header()」?
05/06 12:45, 1F

05/06 13:27, , 2F
樓上,應該是可以,因為下一行是header($header);
05/06 13:27, 2F

05/06 13:27, , 3F
雖然有點多此一舉...
05/06 13:27, 3F

05/07 11:06, , 4F
後來有修正了 , 不過這似乎不是zip 變成 zip.html 原因
05/07 11:06, 4F

05/07 11:06, , 5F
依然找不到原因中~"~
05/07 11:06, 5F
文章代碼(AID): #1LI4yaGf (PHP)
討論串 (同標題文章)
文章代碼(AID): #1LI4yaGf (PHP)