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

WBOY
發布: 2016-07-21 15:30:04
原創
1077 人瀏覽過

复制代码 代码如下:

/*
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"...
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板