我正在使用Zubarg智能文件下载,以强制我的用户使用下载音频文件
download.php?f=FileName
我想要这个download.php从不同的文件夹中读取mp3文件,这些文件夹在中定义
define('BASE_DIR','downloads/');
如何在上面添加多个目录进行读取??
感谢
这就是您需要的代码。
header("Content-Description: File Transfer;");
header('Content-Type: audio/mpeg');
header('Content-Disposition: attachment, filename="' . $temp['file'] . $temp['fileext'].'";');
header("Content-Length: ".filesize(BASE_DIR.$temp['file']));
readfile(BASE_DIR.$temp['file']);