header(“Content-type: text/css”); is working in Firefox and Chrome, but in Internet Explorer 9 it shows up as 'text/html'

前端 未结 8 1068
时光取名叫无心
时光取名叫无心 2020-12-01 09:12

header(\"Content-type: text/css\"); works in Firefox, Chrome and other, but not in Internet Explorer 9. I am not sure what\'s up.

In Chrome an

8条回答
  •  天涯浪人
    2020-12-01 09:44

    The article Handle Images/CSS/JS as PHP without httpd.conf Using .htaccess helped me figure out the issue.

    You basically do all the same stuff as everyone else mentioned (setting header in PHP, etc.), but also use .htaccess to set the AddHandler param.

    
        ForceType application/x-httpd-php
        AddHandler application/x-httpd-php .css
    
    

    This way you can name it with .css and still have PHP parse it.

提交回复
热议问题