Re: [請益] 請問關於壓縮檔下載 抓完後確無法解壓縮
※ 引述《gyd (ipod touch之路)》之銘言:
: 先提供一下出問題的網址
: http://mail.csie.ncyu.edu.tw/~s0914707/SanguoMusou4.php
: 我很確定該資料檔是對的,我比對大小發現大小都是對的,但是卻是壞的
: 使用winrar內建的壓縮檔修復工具則可以成功修復
: 訊息是說標頭損壞
: 想請問是那邊有問題
: 以下為download.php的內容,Button只作連結的工作
: <?php
: ob_start();
: $file_name = $_GET[file];
: $file_url = rawurlencode($file_name);
: header('Content-Description: File Transfer');
: header('Content-Type: application/octet-stream');
: header("Content-Disposition: attachment; filename=$file_name");
: header('Content-Transfer-Encoding: binary');
: header('Expires: 0');
: header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
: header('Pragma: public');
: header('Content-Length: ' . filesize($file_name));
: ob_clean();
: flush();
: readfile($file_url);
: ?>
: 順便再問一下,如何隱藏滑鼠移上Button時,在瀏覽器最左下會顯示的連結位置
自問自答
ob_start()拿掉即可
另外,是否有人可以清楚的解釋以下2個function
ob_clean()
flush()
因為我在download.php中呼叫時,download.php?file=XXX.rar
只要有傳入參數,就得要用ob_start()去作緩衝
但是我發現用ob_clean();flush()這個方式去做卻不會造成這樣的bug
更誇張的是連ob_start都不用加了
有大師可以解惑?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.127.240.89
推
04/30 02:46, , 1F
04/30 02:46, 1F
→
04/30 02:47, , 2F
04/30 02:47, 2F
→
04/30 13:17, , 3F
04/30 13:17, 3F
推
04/30 20:55, , 4F
04/30 20:55, 4F
→
05/01 07:54, , 5F
05/01 07:54, 5F
→
05/01 07:55, , 6F
05/01 07:55, 6F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):