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 常用类汇总 推荐收藏

图表库下面的类库可以让你很简单就能创建复杂的图表和图片。当然,它们需要GD库的支持。pChart - 一个可以创建统计图的库。Libchart - 这也是一个简单的统计图库。JpGrap...

PHP中curl_setopt函数用法实例分析

本文实例讲述了PHP中curl_setopt函数用法。分享给大家供大家参考。具体分析如下: curl_setopt函数是php中一个重要的函数,它可以模仿用户的一些行为,如模仿用户登录,...

php 读写json文件及修改json的方法

实例如下所示: // 追加写入用户名下文件 $code="001";//动态数据 $json_string = file_get_contents("text.json");...

phpmyadmin的#1251问题

mysql> update mysql.user SET Password = OLD_PASSWORD('newpwd...

PHP提交表单失败后如何保留已经填写的信息

本文介绍PHP提交表单失败后如何保留填写的信息一些方法总结,其中最常用的就是使用缓存方式了,这种方法如果网速慢是可能出问题的,最好的办法就是使用ajax了。 1.使用header头设置缓...