我正在尝试缓存一个从非常慢的 API 获取/处理数据的页面 - 所以我可以快速将其加载给用户。但是由于某种原因,输出缓冲区是空的?
<?php
ob_start();
// here I have php scripting accessing api's for information
?>
// Here I have HTML content with some php conditions and echos to filter and display the gathered information
// then I try to save the buffered page to the database:
<?php
//connect to database
$page = ob_get_contents();
mysql_query("UPDATE `pages` SET `page_cache` = '" . $page . "' WHERE `page_id` = '" . $page_id . "'");
?>
任何帮助,将不胜感激!