网络编程 
首页 > 网络编程 > 浏览文章

php压缩多个CSS为一个css的代码并缓存

(编辑:jimmy 日期: 2024/9/25 浏览:3 次 )
复制代码 代码如下:
<?php
/*
Compress multiple CSS files into one and cache for an hour.

Use the same code for Javascript, but replace below "text/css" with "text/javascript" and of course make sure you include .js files instead of .css ones.
*/
ob_start("ob_gzhandler");
header("Content-type: text/css; charset: UTF-8");    
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 60*60)." GMT");

include('somefile.css');
echo "\n\n";
include('anotherfile.css');
echo "\n\n";

ob_flush();
上一篇:php将fileterms函数返回的结果变成可读的形式
下一篇:flash用php连接数据库的代码
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 SiteMap