用PHP缓存HTML输出 [英] Caching HTML output with PHP

查看:81
本文介绍了用PHP缓存HTML输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的网站上的php页面创建一个缓存。我找到了太多的解决方案,但我想要的是一个脚本,可以从我的数据库前生成一个HTML页面:

I would like to create a cache for my php pages on my site. I did find too many solutions but what I want is a script which can generate an HTML page from my database ex:

我有一个页面,用于抓取所有类别的类别来自数据库,所以脚本应该能够生成一个排序的HTML页面:my-categories.html。那么如果我选择一个类别,我应该得到一个my-x-category.html页面等等等等等等。其他类别和子类别。

I have a page for categories which grabs all the categories from the DB, so the script should be able to generate an HTML page of the sort: my-categories.html. then if I choose a category I should get a my-x-category.html page and so on and so forth for other categories and sub categories.

我可以看到一些网站的网址是:wwww.the-web-site.com/the-page-ex.html

I can see that some web sites have got URLs like: wwww.the-web-site.com/the-page-ex.html

即使它们是动态的。

非常感谢帮助

thanks a lot for help

推荐答案

检查ob_start()函数

check ob_start() function

ob_start();
echo 'some_output';
$content = ob_get_contents();
ob_end_clean();

echo 'Content generated :'.$content;

这篇关于用PHP缓存HTML输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆