首页  >  文章  >  后端开发  >  php压缩多个CSS为一个css的代码并缓存_PHP教程

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

WBOY
WBOY原创
2016-07-21 15:30:041075浏览

复制代码 代码如下:

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/323290.htmlTechArticle复制代码 代码如下: ?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"...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn