亲宝软件园·资讯

展开

压缩多个CSS为一个css php压缩多个CSS为一个css的代码并缓存

人气:0
想了解php压缩多个CSS为一个css的代码并缓存的相关内容吗,在本文为您仔细讲解压缩多个CSS为一个css的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:php,CSS,缓存,下面大家一起来学习吧。
复制代码 代码如下:

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

加载全部内容

相关教程
猜你喜欢
用户评论