更新时间:2023-02-08 18:45:00
看一看 mime_content_type 或 文件信息.这些是内置的 PHP 命令,用于通过查看文件的内容来确定文件的类型.还检查了上面两页的评论,还有一些其他的好建议.
Take a look at mime_content_type or Fileinfo. These are built-in PHP commands for determining the type of a file by looking at the contents of the file. Also check the comments on the above two pages, there are some other good suggestions.
就我个人而言,使用本质上是 system("file -bi $uploadedfile")
的东西我很幸运,但我不确定这是否是***的方法.
Personally I've had good luck using something that's essentially system("file -bi $uploadedfile")
, but I'm not sure if that's the best method.