Home > Article > Backend Development > case western reserve universit php compresses multiple CSS into one css code and caches it
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.