PHP下载MP3文件代码

假如现在有大量的MP3链接,,需要用PHP下载链接的mp3文件,怎么实现

<?php
$cont=fopen('http://www.niutw.com/71cd8c4b7576a9601f953d21d8a973b8.mp3','r');
$fcontent = fread($cont, filesize('http://www.niutw.com/71cd8c4b7576a9601f953d21d8a973b8.mp3'));
fclose($cont);
//发送mp3文件MIME 头
header('Content-Type: audio/mp3');
// 发送下载附件头.
header("Content-disposition: attachment; filename=\"test.mp3\"");
header('Content-transfer-encoding: binary');
echo $cont;
exit;
?>

更多: PHP教程

你可能感兴趣的:(php教程,PHP学习)