大佬教程收集整理的这篇文章主要介绍了使用php进行页面缓存,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<?PHP $cachefile = "cache/".$reqfilename.".html"; $cachetime = 5 * 60; // 5 minutes // Serve from the cache if it is younger than $cachetime if (file_exists($cachefilE) && (time() - $cachetime < filemtime($cachefilE))) { include($cachefilE); echo "<!-- Cached ".date('jS F Y H:i',filemtime($cachefilE))." -->n"; exit; } ob_start(); // start the output buffer ?> .. Your usual PHP script and HTML here ... <?PHP // open the cache file for wriTing $fp = fopen($cachefile,'w'); // save the contents of output buffer to the file fwrite($fp,ob_get_contents()); // close the file fclose($fp); // Send the output to the browser ob_end_flush(); ?>
这是一个简单的缓存类型,
你可以在这里看到它
http://www.theukwebdesigncompany.com/articles/php-caching.php
你可以使用smarty有缓存技术
@L_616_18@
@H_403_1@以上是大佬教程为你收集整理的使用php进行页面缓存全部内容,希望文章能够帮你解决使用php进行页面缓存所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。