php压缩多个CSS为一个css的代码并缓存_php技巧
程序员文章站
2022-05-10 20:25:31
...
复制代码 代码如下:
/*
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代码
下一篇: PHPCMS发布页面的栏目选择问题