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实现保存submit内容之后禁止刷新

复制代码 代码如下: $strsql = "INSERT INTO `xxx` (`aaa`) VALUES ('".$_POST["bbb"]."','".$_POST["ccc"]....

PHP5.0~5.6 各版本兼容性cURL文件上传功能实例分析

本文实例分析了PHP5.0~5.6 各版本兼容性cURL文件上传功能。分享给大家供大家参考,具体如下: 最近做的一个需求,要通过PHP调用cURL,以multipart/form-dat...

php指定长度分割字符串str_split函数用法示例

本文实例讲述了php指定长度分割字符串str_split函数用法。分享给大家供大家参考,具体如下: 示例1: $str = 'abcdefgh'; $arr = str_split(...

解析php dirname()与__FILE__常量的应用

__FILE__表示当前所在文件的绝对路径包括文件名,dirname(__FILE__)表示当前文件的绝对路径,basename(__FILE__)表示当前文件的文件名称,dirname...

PHP similar_text 字符串的相似性比较函数

PHP 提供了一个极少使用的 similar_text 函数,但此函数非常有用,用于比较两个字符串并返回相似程度的百分比,以下是similar_text () 函数的使用方法: 复制代码...