php压缩多个CSS为一个css的代码并缓存
2018-10-12 13:56
525 查看
<?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();
您可能感兴趣的文章:
相关文章推荐
- php压缩多个CSS为一个css的代码并缓存
- php压缩CSS代码 可换行
- 压缩你的PHP、JS、CSS等文本类型代码
- 随手做的一个用PHP压缩javascript,css的小脚本
- 一个完整的PHP ZIP压缩类的代码
- 一个简单的php MVC留言本实例代码(必看篇)
- php图片压缩代码
- php列出一个目录下的所有文件的代码
- PHP压缩图片代码
- nginx+php+minify 压缩你的css、js 详解
- PHP下利用header()函数设置浏览器缓存的代码
- PHP 一个随机字符串生成代码
- 一个PHP的String类代码
- 注意 Laravel 清除缓存 php artisan cache:clear 的一个坑
- 加密PHP代码及PHP Opcode缓存小结
- php缓存技术详细介绍及php缓存的实现代码
- 一个简单至极的PHP缓存类代码
- 一个PHP并发访问实例代码
- 使用PHP下载CSS文件中的图片的代码
- 贴一段代码吧,纯PHP的,只是一个项目中的一部分