包括:带有.php文件扩展名的CSS? [英] Include: CSS with .php file extension?

查看:85
本文介绍了包括:带有.php文件扩展名的CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用PHP封装CSS文件...所以我写了CSS文件的标题,并给了它一个.php文件扩展名,因此... css.php.

I'd like to wrap a CSS file in PHP... So I write the header for the CSS file and give it a .php file extension, thus... css.php.

如果该页面已被用作包含内容,此功能会起作用吗?还是这个新标题与页面所包含的框架冲突?

Will this work if the page is already being used as an include? Or will this new header clash with the frame the page is being included into?

推荐答案

gnarf钉了它.

我这样做:

<link rel="stylesheet" type="text/css" media="screen" href="<? echo TMPL ?>css/name-of-file.css.php">

,然后在您的.css.php文件顶部:

and then in top of your .css.php file:

<?
header('Content-Type: text/css');
// print out your php-driven css...
?>

这篇关于包括:带有.php文件扩展名的CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆