如何支持从所有浏览器下载mp3


How to support mp3 download from all browsers

我想提供一个mp3文件,并可以从每个可能的浏览器下载。

似乎一团糟。

链接已经具有下载属性,该属性在某些地方有效。

然后我尝试使用 apache configRewriteEngine 打开

RewriteCond %{QUERY_STRING} ^view=download$
RewriteRule .*'.mp3$ - [L,T=applicaton/octet-stream]

<FilesMatch "'.(?i:mp3)$">
  ForceType audio/mpeg
  SetEnvIf Request_URI "^.*/?([^/]*)$" FILENAME=$1
  Header set Content-Disposition "attachment; filename=%{FILENAME}e"
  UnsetEnv FILENAME
</FilesMatch>

我在网上找到的其他人似乎都没有让我从Android上的移动chrome下载,是否有任何全方位的解决方案或组合解决方案?

我使用这样的PHP代码下载文件

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-type: application/mp3");
header("Content-Disposition: attachment; filename='"" . basename($fullPath) . "'";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($fullPath));
readfile($fullPath);