php压缩多个CSS为一个css的代码并缓存
作者:bea
代码如下: <?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.
代码如下:
<?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 "
";
include('anotherfile.css');
echo "
";
ob_flush();
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- vs中通过剪切板循环来循环粘贴不同内容
- php获取mysql数据库中的所有表名的代码
- 使用GROUP BY的时候如何统计记录条数 COUNT(*) DISTINCT
- mysql_num_rows VS COUNT 效率问题分析
- fleaphp rolesNameField bug解决方法
- FirePHP 推荐一款PHP调试工具
- 在smarty模板中使用PHP函数的方法
- 对text数据类型不支持代码页转换 从: 1252 到: 936
- fleaphp crud操作之find函数的使用方法
- fleaphp crud操作之findByField函数的使用方法
- fleaphp常用方法分页之Pager使用方法
- PHP中限制IP段访问、禁止IP提交表单的代码
- PHP计划任务、定时执行任务的实现代码
- PHP导入Excel到MySQL的方法
- 在php和MySql中计算时间差的方法
- PHP遍历二维数组的代码
- PHP中调用ASP.NET的WebService的代码
- php中利用post传递字符串重定向的实现代码
- php将fileterms函数返回的结果变成可读的形式