包括:css与php文件扩展名? [英] Include: css with php file extension?

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

问题描述

我想包装一个css文件在php ...所以我写的css文件的标题,并给它一个php扩展,因此... css.php。问题是这个工作,如果页面已经被用作一个包括...或者这个新的标题与框架的页面被包括在??? ???



我这样做:

 < link rel =stylesheettype =text / cssmedia =screenhref =< ;? echo TMPL?> css / name-of-file.css。 php> 

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

 < ;? 
header('Content-Type:text / css');
//打印出你的php驱动的css ...
?>


I'd like to wrap a css file in php... So I write the header for the css file and give it a php extension, thus... css.php. The question is 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 nailed it.

I do:

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

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

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

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

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