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

相关文章

thinkphp框架下实现登录、注册、找回密码功能

本文实例为大家分享了thinkphp框架下使用ajax表单提交的登录、注册、找密码的实现方法,以及注册后的用户需后台审核。 user表的字段为id、num、password、name、e...

PHP浮点数精度问题汇总

一、PHP浮点数精度损失问题 先看下面这段代码: 复制代码 代码如下: $f = 0.57; echo intval($f * 100);  //56 结果可能有点出乎你的意...

php代码收集表单内容并写入文件的代码

至于表单内容,这里就不多说了,主要是表单的action="getpost.php",也就是写getpost.php这个文件。下面就把这个文件里面的内容贴出来。 复制代码 代码如下: &l...

flash用php连接数据库的代码

php代码:复制代码 代码如下: /* /flashservices/services/Catalog.php */ class Catalog {     &nbs...

php实现比较全的数据库操作类

本文实例讲述了php实现比较全的数据库操作类。分享给大家供大家参考。具体如下: <?php class database { private $hostname...