看板 PHP 關於我們 聯絡資訊
※ 引述《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時,在瀏覽器最左下會顯示的連結位置 抓下來一 dump 出來就知道問題出在哪了... 你的 download.php 是否是用記事本存成 UTF-8 的? 是的話會有 BOM 問題 (所以抓下來的檔案開頭多了 3 byte 的 BOM => 因為設定了 Content-Length 造成最後 3 byte 被丟掉了 => 壓縮檔損壞 否則一般這種在壓縮檔資料前面多東西的情形 Winrar 是可以正確解壓縮的) 如果 download.php 裡沒有中文的話 (這樣看來應該也是沒有) 把它另存一次 編碼選 ANSI 這樣就可以了 -- 'Oh, Harry, dont't you see?' Hermione breathed. 'If she could have done one thing to make absolutely sure that every single person in this school will read your interview, it was banning it!' ---'Harry Potter and the order of the phoenix', P513 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.30.84