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

前端之家收集整理的这篇文章主要介绍了php压缩多个CSS为一个css的代码并缓存前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="21030" class="copybut" id="copybut21030" onclick="doCopy('code21030')"> 代码如下:

<div class="codebody" id="code21030">
<?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();

原文链接:https://www.f2er.com/php/28039.html

猜你在找的PHP相关文章