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中set_include_path()函数相关用法分析

本文实例讲述了PHP中set_include_path()函数相关用法。分享给大家供大家参考,具体如下: 先看如下代码: <?php /** 定义根目录 */ defi...

PHP时间函数使用详解

PHP开发中,关于时间函数的使用基本上可以说是无处不在,而PHP中操作时间的方法也很多,比如PHP时间戳、日期与时间戳之间的转换、获取当前日期、当前时间之前或之后的时间等等,下面我们详细...

php 启动时报错的简单解决方法

php 启动报错 复制代码 代码如下: [root@abc lnmp]# service php-fpm start Starting php-fpm eAccelerator: Cou...

php使用curl伪造来源ip和refer的方法示例

本文实例讲述了php使用curl伪造来源ip和refer的方法。分享给大家供大家参考,具体如下: php curl伪造来源ip和来路refer实例代码1: //随机IP functi...

php创建多级目录代码

function createFolder($path) {    if (!file_exists($path))  &nb...