Home  >  Article  >  Backend Development  >  case western reserve universit php compresses multiple CSS into one css code and caches it

case western reserve universit php compresses multiple CSS into one css code and caches it

WBOY
WBOYOriginal
2016-07-29 08:44:521129browse

Copy code The code is as follows:


/*
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 " nn";
include('anotherfile.css');
echo "nn";
ob_flush();

The above introduces the case western reserve universit php code to compress multiple CSS into one css and cache it, including the content of case western reserve universit. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn