我已在我的音乐网站上添加了以下脚本以下载mp3文件。.但是,当我使用该脚本时,下载音乐文件的专辑封面图片丢失了。请给我一个解决方案...
<?php
ob_start();
require_once('../../../private/initialize.php');
echo ($_GET['song_id']);
$id = $_GET['song_id'];
$file = basename(get_songs_title($id) .'.mp3');
if(!file_exists($file)){ // file does not exist
die('file not found');
} else {
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type:audio/mp3, audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3");
header("Content-Disposition: attachment; filename=$file");
header("Content-Transfer-Encoding: binary");
readfile($file);
downloadSongCounter($id);
downloadArtisSongCounter($id);
}
ob_end_flush();
?>