在css使用PHP/ASP代码

http://www.corange.cn/archives/2008/06/1242.html 这个是我在使用的例子,当然也许有一些不足,这里写出来给大家参考下 当然在ASP中也是可以用的 我的这个例子是动态改变背景色,因为前台是生成静态页的,才考虑到用这个方法 先将CSS文件命名为php文件 <link href="../css/corange.css.php" rel="stylesheet" type="text/css"> _fcksavedurl=""../css/corange.css.php" rel="stylesheet" type="text/css">" _fcksavedurl=""../css/corange.css.php" rel="stylesheet" type="text/css">" _fcksavedurl=""../css/corange.css.php" rel="stylesheet" type="text/css">" 然后在CSS.PHP文件中 BODY {         FONT-FAMILY: 宋体;          color:#464646;          font-size:12px;         margin-left: 0px;         margin-top: 0px;         margin-right: 0px;         margin-bottom: 0px;         background-color: #<?php         require('../Connections/cn.php');         $sql22 = "select id,bgcolor from config where id=1";         $result22 = mysql_query( $sql22 );         $res_now22 = mysql_fetch_array($result22);//不能用mysql_fetch_row         $bgcolor = $res_now22['bgcolor'];          echo $bgcolor?>;; } 注意这段PHP代码不能放在顶部
posted @ 2008-06-08 21:13  ajuanabc  阅读(171)  评论(0编辑  收藏  举报