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

相关文章

做了CDN获取用户真实IP的函数代码(PHP与Asp设置方式)

asp函数代码:复制代码 代码如下:function checkip(checkstring)'用正则判断IP是否合法dim re1set re1=new RegExpre1.patte...

php和C#的yield迭代器实现方法对比分析

本文实例讲述了php和C#的yield迭代器实现方法对比。分享给大家供大家参考,具体如下: yield关键字是用来方便实现迭代器的,免去了手工写迭代器的繁琐。迭代器常被用来实现协程,所以...

php结合安卓客户端实现查询交互实例

PHP 服务器端: function getids() { $this->output->set_header('Content-Type: application...

php 文件缓存函数

复制代码 代码如下: function createHashDir($sign) { $md5 = md5($sign); if(!is_dir(MB_CACHE)) mkdir(MB_...

php中使用临时表查询数据的一个例子

复制代码 代码如下:$sql3="CREATE TEMPORARY TABLE atmp_table(uid int(11),dnum int(20) not null)"; ...