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建立Ftp连接的方法

本文实例讲述了php建立Ftp连接的方法。分享给大家供大家参考。具体分析如下: 今天看了下ftp函数,总结一下: FTP相关函数: ftp_connect(host,part,timeo...

phpcms的分类名称和类别名称的调用

话不多说,请看代码: //在需要调用的模板前写这句代码,$CATEGORYS 代表分类,$TYPE 代表类别(没有这句话,调不出来) {php $CATEGORYS = getcac...

thinkphp多表查询两表有重复相同字段的完美解决方法

框架:thinkphp 版本:3.2.3 内容:查询语句 解决问题:重复字段问题 $Data = M('a')->where($where) ->Fiel...

php中current、next与reset函数用法实例

本文实例讲述了php中current、next与reset函数用法。分享给大家供大家参考。 具体代码如下: 复制代码 代码如下:$array=array('step one','step...

php自动提交表单的方法(基于fsockopen与curl)

本文实例讲述了php基于fsockopen与curl实现自动提交表单的方法。分享给大家供大家参考,具体如下: fsockopen和curl都可以做php自动提交表单 1. fsockop...