phpob_start()ob_end_flush()缓存技术简单应用_PHP教程
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了phpob_start()ob_end_flush()缓存技术简单应用_PHP教程,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1060字,纯文字阅读大概需要2分钟。
内容图文
![phpob_start()ob_end_flush()缓存技术简单应用_PHP教程](/upload/InfoBanner/zyjiaocheng/173/406ca4bd16a74feeb88446814c5a7187.jpg)
代码如下 | |
// define the path and name of cached file $cachefile = 'cached-files/'.date('M-d-Y').'.php'; // define how long we want to keep the file in seconds. I set mine to 5 hours. $cachetime = 18000; // Check if the cached file is still fresh. If it is, serve it up and exit. if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) { include($cachefile); exit; } // if there is either no file OR the file to too old, render the page and capture the HTML. ob_start(); ?> output all your html here. // We're done! Save the cached content to a file $fp = fopen($cachefile, 'w'); fwrite($fp, ob_get_contents()); fclose($fp); // finally send browser output ob_end_flush(); ?> |
http://www.bkjia.com/PHPjc/444708.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444708.htmlTechArticle本文章介绍了一个简单的关于php入门篇-缓存技术简单应用,有需要的朋友可以看看哦,这里是利用了ob_start(); ob_end_flush(); 来实例的。 代码...
内容总结
以上是互联网集市为您收集整理的phpob_start()ob_end_flush()缓存技术简单应用_PHP教程全部内容,希望文章能够帮你解决phpob_start()ob_end_flush()缓存技术简单应用_PHP教程所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。