当前位置: 移动技术网 > IT编程>开发语言>PHP > php压缩多个CSS为一个css的代码并缓存

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

2019年04月23日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:

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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网