[請益] 使用header下載MP3 檔案都只有 0 K
各位大大
不好意思小弟又有問題要問了
在網路上找了很多header下載MP3的方法
但是不管怎樣下載下來的資料都是 0 K
希望各位大大能夠幫幫小弟是不是程式碼哪邊寫錯了
程式碼如下:
$filename="back.mp3";
$myfile = "/home/httpd/html/www.xxx.com/test/back.mp3";
$mm_type = "application/octet-stream";
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($myFile)) );
這一段改寫成這樣結果也一樣
header("Content-Length: " .filesize($myFile));
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary");
readfile($myFile);
希望各位大大幫我看看是不是哪邊有問題
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.81.19.118
※ 編輯: angelmark 來自: 219.81.19.118 (09/22 11:03)
※ 編輯: angelmark 來自: 219.81.19.118 (09/22 11:42)
→
09/22 13:07, , 1F
09/22 13:07, 1F
→
09/24 15:53, , 2F
09/24 15:53, 2F
→
09/25 07:34, , 3F
09/25 07:34, 3F
→
09/25 07:34, , 4F
09/25 07:34, 4F