[英]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.