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

相关文章

php计算税后工资的方法

本文实例讲述了php计算税后工资的方法。分享给大家供大家参考。具体如下: 税前  税后 5000  3985 8000  6215 11000 ...

php Undefined index和Undefined variable的解决方法

$act=$_POST['act']; 用以上代码总是提示 Notice: Undefined index: act in F:\win...

PHP+redis实现微博的推模型案例分析

本文实例讲述了PHP+redis实现微博的推模型。分享给大家供大家参考,具体如下:最近在看了一下关于redis的内容,然后利用redis写了一个简单的微博项目,这篇文章是关于推模型的。推模型所谓推模型...

PHP实现动态柱状图改进版

PHP实现动态柱状图改进版

本文实例分析了PHP实现动态柱状图的改进版。分享给大家供大家参考。具体分析如下: 前面已经写过如果只做动态柱状图的情况,其实原理还是很简单的。因为昨天下午有新的需求,今天上午又修改了一番...

PHP文件操作方法汇总

在data文件中写入数据: <?php /** * Created by PhpStorm. * User: Administrator * Date: 20...