如何在php样式表中使用@import?

112*_*233 0 css php import

由于某种原因,我创建了带.php扩展名的样式表.
在style.php上

<?php
/*** set the content type header ***/
/*** Without this header, it wont work ***/
header("Content-type: text/css");

$color = '#ff0000';
$path = 'http://mysite.localhost.com/includes/css/';
?>
//this works
body {
    background-color:<?=$color?>;
}
 //these don't work
@import url("<?=$path?>foundation.css");
@import url("<?=$path?>app.css");
Run Code Online (Sandbox Code Playgroud)

我不明白为什么@import根本不起作用.

即使是没有变量的普通网址,它也不起作用.

@import url("http://mysite.localhost.com/includes/css/foundation.css");
Run Code Online (Sandbox Code Playgroud)

我以前用过.css文件.但是我无法使用php变量/常量替换这样的url.

在style.css上

@import url("<?php $path?>style.css");  
Run Code Online (Sandbox Code Playgroud)

Alf*_*aul 5

尝试另一个

   <?php
    $css = file_get_contents('CSS/style.css');
    echo $css;
    ?>
Run Code Online (Sandbox Code Playgroud)