使用PHP作为CSS文件?

Jac*_*don 6 css php google-chrome include

我将如何使用PHP作为CSS文件.我刚将它作为普通的css文件包含在内,但它无法在Google Chrome中运行.

Gan*_*mar 10

您必须告诉浏览器它是一个CSS文件而不是HTML文件,在任何输出之前写下以下内容:

<?php header("Content-type: text/css"); ?>
Run Code Online (Sandbox Code Playgroud)

请参阅:http: //www.barelyfitz.com/projects/csscolor/


小智 8

尝试添加

<?php header("Content-type: text/css"); ?>
Run Code Online (Sandbox Code Playgroud)

在stylesheet.php的第一行