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错误Cannot use object of type stdClass as array in错误的解决办法

很多人在PHP输出一个二维数组的时候出现“Fatal error: Cannot use object of type stdClass as array in……”。解决办法分析如下:...

PHP针对常规模板引擎中与CSS/JSON冲突的解决方法

本文实例讲述了PHP针对常规模板引擎中与CSS/JSON冲突的解决方法,有一定的实用价值,具体分析如下: 本文主要针对对象为Smarty与Dwoo 在Smarty中经常会出现和CSS/J...

PHP中的array数组类型分析说明

php的数组的key 可以是string类型也可以是integer类型。如果key为一个float类型,会自动的转化为integer类型。 如果没有为一个value指定一个key,int...

yii 2.0中表单小部件的使用方法示例

前言 本文主要介绍的是关于yii 2.0中表单小部件使用的相关内容,分享出来供大家参考学习,下面来看看详细的介绍: 使用方法 首先创建model层,因为要使用表单小部件 所以要加载相应的...

php强制下载类型的实现代码

复制代码 代码如下: function downloadFile($file){ /*Coded by Alessio Delmonti*/       &...