Php doesn't return the correct mime type

前端 未结 5 1784
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 18:02

The finfo function is returning crazy mime types. Look the following code, what is going on?



        
5条回答
  •  -上瘾入骨i
    2020-12-20 18:20

    I'm not intimately familiar with the workings of fileinfo, but I think this is normal. Text files (and that's what CSS and JS are) provide no clear pointers as to what content it has. They have no header bytes, no defined structure. So all poor fileinfo can do is guess - with poor results, as you can see.

    I think to successfully verify the contents of .js and .css files, you have to either rely on the extension, or actually parse them with the correct, appropriate parser.

提交回复
热议问题