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

相关文章

使用session判断用户登录用户权限(超简单)

如下所示:复制代码 代码如下:<form action="#" method=post>用户名:<input type=text name=user><br...

php自动加载方式集合

php加载文件方式: 1、include,include_once,requice,requice_one常规加载 2、__autoload() 3、spl_autoload_regis...

php调用云片网接口发送短信的实现方法

php调用云片网接口发送短信的实现方法 云片网发送短信 /** * [SendSms description] * @param [string] $tpl_conten...

PHP工厂模式的日常使用

负责生成其他对象的类或方法,这就是工厂模式,下面是一个经常见到的用法 <?php class test{ public $x=1; public $settin...

php简单实现查询数据库返回json数据

示例代码一: // 设置返回json格式数据 header('content-type:application/json;charset=utf8'); //连接数据库 $link...