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

yipeiwu_com6年前PHP代码库
复制代码 代码如下:

<?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();

相关文章

深入Apache与Nginx的优缺点比较详解

1、nginx相对于apache的优点:  轻量级,同样起web 服务,比apache占用更少的内存及资源  抗并发,nginx 处理请求是异步非...

扩展你的 PHP 之入门篇

扩展你的 PHP 之入门篇

扩展你的php 扩展你的php 扩展的3种方式 extension dll方式的扩展 小结   首先注意,以下所有的一切皆在 win 下进行,使用的工具的 VC++6.0。 扩展...

Zend 输出产生XML解析错误

XML解析错误:xml处理指令不在实体的开始部分 位置:http://.../public/xml/get 行:2,列:1:<?xml version="1.0"?> ^ 仔...

php项目打包方法第1/2页

企业网站好说,至少需要个虚拟主机什么的;可是OA,财务……这些内部系统就不好说了,总不能把代码和数据库扔给人家,写个说明,让他们自己照着说明去配置环境,安装代码吧。这样显然不像话,要知道...

php SQL防注入代码集合

SQL防注入代码一复制代码 代码如下: <?php /** * 防sql注入 * @author: zhuyubing@gmail.com * */ /** * reject sq...