2011-12-22 63 views

回答

2

使用的Content-disposition頭應該這樣做:

header("Content-disposition: attachment; filename=some_file.ext"); 

還包括Content-type頭是很好的做法,以及(特別是如果你使用的是PHP網頁服務的話):

header("Content-type: mime/type"); 

ex音頻/ mpeg(mp3),視頻/ mp4

+0

感謝您的回覆,但我可以在哪裏放置該代碼? – yuri04 2011-12-22 10:49:43

+0

在php頁面的頂部。必須在任何輸出之前使用'header()'函數。 – Grexis 2011-12-22 10:52:11

+0

這對我來說並不正常。它會下載php文件,而不是輸出文件:( – yuri04 2011-12-22 11:14:55

相關問題