[英]How to make an mp3 file from another site downloadable
我幾乎不敢問這樣一個基本的問題,當我和朋友在一起時,我如何稱自己為網站天才呢?
我試圖吸引訪問者到我的站點下載mp3鏈接=>“ http://www.podbean.com/podcast-directory-download-public/4995714/10_Commandments_Of_A_Successful_Home_Pst_Abiodun_Koloewo.mp3 ”。 但是我面臨的問題是,除非右鍵單擊並選擇“將鏈接另存為”,否則它不會下載,並且由於該文件不在我的服務器上,因此我無法對其進行任何處理。 這里有什么幫助嗎?
您有兩種方法,其中一種僅適用於Chrome。
盡管在Firefox中使用了In Firefox 20 this attribute is only honored for links to resources with the same-origin.
,但它指出: In Firefox 20 this attribute is only honored for links to resources with the same-origin.
所以它不起作用。
例:
<a href="http://www.podbean.com/podcast-directory-download-public/4995714/10_Commandments_Of_A_Successful_Home_Pst_Abiodun_Koloewo.mp3" download>Download Song</a>
例:
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment;filename=\"10_Commandments_Of_A_Successful_Home_Pst_Abiodun_Koloewo.mp3\"");
readfile("http://www.podbean.com/podcast-directory-download-public/4995714/10_Commandments_Of_A_Successful_Home_Pst_Abiodun_Koloewo.mp3");
為了使該示例正常工作,請啟用allow_url_fopen
。
除此之外,我建議將歌曲文件保存在服務器上,以便可以再次從服務器下載對此歌曲的新請求。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.