Using PHP as a CSS file?

How can I use PHP as a CSS file. I just included it as a regular css file, but it does not work in Google Chrome.

+6
source share
2 answers

You should tell the browser that this is a CSS file, not an HTML file, write the following before any output:

<?php header("Content-type: text/css"); ?> 

See: http://www.barelyfitz.com/projects/csscolor/

+9
source

Try to add

 <?php header("Content-type: text/css"); ?> 

in the first line of your stylesheet.php

+8
source

Source: https://habr.com/ru/post/908892/


All Articles