我试图隐藏一个从非常慢的 API s 获取/处理数据的页面, 这样我就能快速地将数据装入用户。 但是由于某种原因, 输出缓冲是空的吗?
<?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 . " ");
?>
任何帮助都会感激不尽!