How can I include CSS in php?

后端 未结 7 488
北恋
北恋 2020-12-10 09:01

i want to include my css/stylesheet via php so that...


so th

相关标签:
7条回答
  • 2020-12-10 10:04

    As long as you set your MIME type in style.php to CSS, you should be in business. Add this to the very top:

    <?php Header ("Content-type: text/css; charset=utf-8");?> 
    

    Another option if you're running on an Apache server is to tell it to check .css files for PHP. Add this to your .htaccess file to do this:

    AddType application/x-httpd-php .css 
    

    Then you could simply include a regular .css file:

    <link rel="stylesheet" href="http://www.mydomain.com/css/style.css">
    
    0 讨论(0)
提交回复
热议问题