mime_content_type returning text/plain for css and js files only

前端 未结 1 558
野的像风
野的像风 2021-01-24 14:20

I\'m encountering this weird issue with PHP\'s mime_content_type, it works fine, except for CSS and JavaScript files, which it returns text/plain for (PHP\'s default mime is set

相关标签:
1条回答
  • 2021-01-24 14:45

    The PHP doc is pretty explicit about that:

    Returns the MIME content type for a file as determined by using information from the magic.mime file.

    PHP and Apache don't use the same mime databases. Apache uses mime.types but PHP uses magic.mime (can't remember where it's located, /etc/ on a Unix system, I think)

    No sure how to edit it on Windows but here are some tips for Linux: How to create a custom magic file database

    0 讨论(0)
提交回复
热议问题