更新时间:2023-02-08 19:18:53
没有精确文件类型"之类的东西.二进制数据是二进制数据.
There's no such thing as "exact file type". Binary data is binary data.
如果您在类似POSIX的系统上运行,则可以使用file
命令来猜测文件类型.我认为这不会给您提供MIME类型.
If you're running on a POSIX-like system, you can use the file
command to guess the file type. I don't think this gives you a MIME type.
如果您的服务器运行的是Apache,则可以使用mod_mime_magic进行猜测.
If your server is running Apache, then you can use mod_mime_magic to make a guess.
如果您使用的是PHP,则可以安装 fileinfo 扩展名.
If you're using PHP, you can install the fileinfo extension.