php 我应该为 mp3 使用哪种 mime 类型

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10688588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 22:49:37  来源:igfitidea点击:

Which mime type should I use for mp3

phpmp3mime-types

提问by Kristian

I'm trying to decide which mime type to choose for returning mp3 data (served up by php)

我正在尝试决定选择哪种 mime 类型来返回 mp3 数据(由 php 提供)

according to this listing of mime types: http://www.webmaster-toolkit.com/mime-types.shtml

根据此 MIME 类型列表:http: //www.webmaster-toolkit.com/mime-types.shtml

.mp3    audio/mpeg3
.mp3    audio/x-mpeg-3
.mp3    video/mpeg
.mp3    video/x-mpeg

What are the difference between these, and which should I use?

这些有什么区别,我应该使用哪个?

回答by saluce

Your best bet would be using the RFC definedmime-type audio/mpeg.

您最好的选择是使用RFC 定义的mime-type audio/mpeg

回答by Eugene Petakhin

I had a problem with mime types and where making tests for few file types. It looks like each browser sends it's variation of a mime type for a specific file. I was trying to upload mp3 and zip files with open source php class, that what I have found:

我在 mime 类型方面遇到了问题,并且对少数文件类型进行了测试。看起来每个浏览器都会为特定文件发送它的 mime 类型的变体。我试图用开源 php 类上传 mp3 和 zip 文件,我发现:

  • Firefox (mp3): audio/mpeg
  • Firefox (zip): application/zip
  • Chrome (mp3): audio/mp3
  • Chrome (zip): application/octet-stream
  • Opera (mp3): audio/mp3
  • Opera (zip): application/octet-stream
  • IE (mp3): audio/mpeg
  • IE (zip): application/x-zip-compressed
  • 火狐 (mp3):音频/mpeg
  • Firefox (zip):应用程序/zip
  • 铬 (mp3): 音频/mp3
  • Chrome (zip):应用程序/八位字节流
  • 歌剧(mp3):音频/mp3
  • 歌剧(zip):应用程序/八位字节流
  • IE (mp3): 音频/mpeg
  • IE (zip): application/x-zip-compressed

So if you need several file types to upload, you better make some tests so that every browser could upload a file and pass mime type check.

因此,如果您需要上传多种文件类型,最好进行一些测试,以便每个浏览器都可以上传文件并通过 mime 类型检查。

回答by zessx

Use .mp3 audio/mpeg, that's the one I always used. I guess others are just aliases.

.mp3 audio/mpeg,我一直用的那个。我想其他人只是别名。

回答by Johnny Zhao

You should always use audio/mpeg, because firefox cannot play audio/mpeg3files

您应该始终使用audio/mpeg,因为 firefox 无法播放audio/mpeg3文件

回答by Madan Sapkota

The standardway is to use audio/mpegwhich is something like this in your PHP headerfunction ...

标准的方法是使用audio/mpeg它像这样在你的PHP功能...

header('Content-Type: audio/mpeg');

header('Content-Type: audio/mpeg');