[英]How can I echo w/ PHP , custom css directives into this css file?
使服务器将CSS文件解析为PHP,然后将其添加到CSS文件的顶部:
<?php Header ("Content-type: text/css");?>
我相信使CSS文件通过PHP运行的.htaccess行是:
AddType application/x-httpd-php .css
警告! Opera将尝试缓存具有CSS内容类型的php文件。 建议除了声明文本/ css内容类型之外,还应在CSS文件的开头包含以下完整代码:
<?php
header("Content-type: text/css");
//http://www.thinkvitamin.com/features/webapps/serving-javascript-fast
//required so Opera does not cache this file
# 'Expires' in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
# Always modified
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
# HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
# HTTP/1.0
header("Pragma: no-cache");
?>
为了提醒自己,这些是css文件,我维护以下命名约定:
file-name.css.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.