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

yipeiwu_com5年前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();

相关文章

php中global和$GLOBALS[]的分析之一

这可能引起一些问题,有些人可能漫不经心的改变一个全局变量。PHP 中全局变量在函数中使用时必须申明为全局(注意,Global这个关键字在函数中定义才有用)。 1:Global的作用是定义...

php自定义urlencode,urldecode函数实例

本文实例讲述了php自定义urlencode,urldecode函数。分享给大家供大家参考。具体如下: //配合JavaScript的ajaxObject函数, 对字串进行转码. f...

php支付宝接口用法分析

本文实例讲述了php支付宝接口用法。分享给大家供大家参考。具体分析如下: 现在流行的网站支持平台,支付宝当仁不让的老大了,现在我们就来告诉你如何使用支付宝api来做第三方支付,把支付宝放...

php UTF8 文件的签名问题

也就是 有BOM 格式编码,或者 无BOM格式编码。 如果看文件的内容,是看不出任何差别的,以下列文件(schema.sqlite.sql)内容为例: schema.sqlite.sql...

奇怪的PHP引用效率问题分析

函数如下: 复制代码 代码如下: function update_timelist(&$arr,$timestamp,$threshold){ $timequeue = &$arr['t...