Alternatives to PHP header function

前端 未结 2 1340
礼貌的吻别
礼貌的吻别 2021-01-13 17:51

I\'m working on a website that has a number of style sheets all of which need to be handled as PHP scripts server-side. My .htaccess file looks som

相关标签:
2条回答
  • 2021-01-13 18:13

    try:

    php_value default_mimetype "text/css"
    
    0 讨论(0)
  • 2021-01-13 18:14

    You should be able to just add a .php extension to all of your CSS files; this will cause the server to pass all of the "normal" CSS as just that, whereas all of your dynamic, PHP-generated CSS should be parsed. After that, it's just a matter of slightly modifying the way in which you link your stylesheets:

    <link rel="stylesheet" type="text/css" href="styles.css.php" />
    

    Though that's always done the trick for me, there's a slight chance you may need to explicitly declare the MIME type of your CSS files using PHP's header() function, like so:

    header('Content-type: text/css');
    
    0 讨论(0)
提交回复
热议问题