1.全页面静态化缓存

<?php

ob_start();//如果php.ini已经开启,那么这里会开启一个新的输出缓冲区;

echo "<!DOCTYPE html>
<html>
<head>
<title>文档的标题</title>
</head>

<body>
文档的内容......
</body>

</html>";

//获取缓冲区中的页面,并清除缓冲区
$content = ob_get_clean();

//将页面保存成为静态文件
file_put_contents("abc.htm",$content);

?>

2.内存式缓存

<?php
$memcachehost = '192.168.6.191';
$memcacheport = 11211;
$memcachelife = 60;
$memcache = new Memcache;
$memcache->connect($memcachehost,$memcacheport) or die ("Could not connect");
$memcache->set('key','缓存的内容');
$get = $memcache->get($key); //获取信息
?>

最新文章

  1. .NET CoreCLR开发人员指南(上)
  2. 简单的浏览器调试——console命令
  3. 学习maple
  4. missing locales
  5. SSRS匿名访问
  6. 最大权闭合图(Road constructions)hdu3917
  7. [改善Java代码]不推荐覆写start方法
  8. 基于jQuery的图片左右轮播,基本原理通用
  9. 编程的宗派(OOP与FP孰优孰劣)--王垠
  10. JQuery 模糊匹配
  11. Java this 关键字的用法
  12. SpringBoot中MongoDB注解概念及使用
  13. ARP欺骗配置及演示过程
  14. complex类的设计实现
  15. Extjs4.2 TreeView TreeStore 移除节点不触发delete(remove node don&#39;t trigger delete method)
  16. JavaScript 浮点数陷阱及解法
  17. ubuntu 16.04安装ibus中文输入法
  18. linux shell 正则表达式(BREs,EREs,PREs)的比较
  19. P2046 [NOI2010]海拔 平面图转对偶图(最小割-》最短路)
  20. fs.createReadStream(filepath).pipe(response);这句是什么意思?

热门文章

  1. 51nod 1832 先序遍历与后序遍历(dfs+高精度)
  2. 1月4日笔记 (vi编辑器)更新...
  3. HTML元素 绑定href属性
  4. (一)PHP简介
  5. ztree异步加载树节点
  6. VC.【转】采用_beginthread/_beginthreadex函数创建多线程
  7. [原][粒子特效][spark]发射器emitter
  8. cmd中mvn命令,出现No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
  9. vue中 父子组件的通讯
  10. Python中数据类型