【php】基于Redis的js、css缓存类
来源:互联网 发布:如何设置监控网络连接 编辑:程序博客网 时间:2024/06/08 19:19
<?php/**基于Redis的js、css缓存类(有效解决tp等框架访问public出现的各种问题)*Written by Radish 2015.8.16*/define('REDIS_HOST', '127.0.0.1');define('REDIS_PORT', 6379);//class im{function __construct(){$this->redis = new Redis();$this->redis->connect(REDIS_HOST,REDIS_PORT);}public function init($array=[]){if($this->redis->get('updated')==1)return;foreach ($array as $k => $v) {if($v[0]=='js')$this->redis->set($k,'<script>'.file_get_contents($v[1]).'</script>');if($v[0]=='css')$this->redis->set($k,'<style>'.file_get_contents($v[1]).'</style>');}$this->redis->set('updated',1);}public function get($content=''){echo $this->redis->get('jquery');}}$setup=['jquery'=>['js','http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js'],'amazeui'=>['css','http://cdn.amazeui.org/amazeui/2.4.2/css/amazeui.css'],'angular'=>['js','http://lib.sinaapp.com/js/angular.js/angular-1.2.19/angular-animate.min.js']];$k=new im();$k->init($setup);$k->get('jquery');
0 0
- 【php】基于Redis的js、css缓存类
- php+redis缓存类
- PHP + redis缓存类
- 基于php缓存的详解
- 基于redis缓存的session共享
- 基于注解的SpringAOP Redis缓存技术
- 基于Redis的消息中心缓存搭建
- 基于Codis的Redis分布式缓存实现
- 基于服务器端缓存redis的简单实现
- php 基于redis计数器类
- php 基于redis计数器类
- 【分布式缓存】——-基于redis分布式缓存的实现
- 【分布式缓存】——-基于redis分布式缓存的实现
- 浅谈php的缓存机制之redis
- 安装Redis前端缓存的PHP脚本
- Redis缓存php数据
- PHP Redis 缓存实例
- 清除css,js,img的浏览器缓存
- 1395 - Slim Span (最小生成树)
- Ignatius and the Princess I (hdu 1026 优先队列+bfs+输出路径)
- java was started but returned exit code=13
- Mac OS X安装redis-php扩展
- Python对xml的操作
- 【php】基于Redis的js、css缓存类
- 机房收费系统之上下机
- 20个你可能不知道的 Linux 网络工具
- 你好,世界!
- 实现一个函数来调整该数组中数字的顺序实例
- Win7 64位VS2010搭建OpenCV2.4.9
- django models进行数据库增删查改
- halcon学习笔记——(4)HDevelop language(结构语句)
- 编程实现木马的ActiveX启动和注入IE的启动方式