侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

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

2023-11-30 星期四 / 0 评论 / 0 点赞 / 27 阅读 / 748 字

复制代码 代码如下: <?php /* Compress multiple CSS files into one and cache for an hour. Use the same code for Javascri

复制代码 代码如下:

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

广告 广告

评论区