加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-13 05:52:26 所属栏目:PHP教程 来源:网络整理
导读:div class="codetitle" a style="CURSOR: pointer" data="21030" class="copybut" id="copybut21030" onclick="doCopy('code21030')" 代码如下: div class="codebody" id="code21030" ?php / Compress multiple CSS files into one and cache for an hour. U

<div class="codetitle"><a style="CURSOR: pointer" data="21030" class="copybut" id="copybut21030" onclick="doCopy('code21030')"> 代码如下:<div class="codebody" id="code21030">
<?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 "nn";
include('anotherfile.css');
echo "nn"; ob_flush();

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读