php - ob_flush 需要很长时间才能执行

标签 php performance drupal-7 output-buffering

在我的网站(使用 drupal 运行)中,ob_flush 函数需要很长时间(在 10 - 100 秒之间)才能执行。我如何找出原因?是什么导致了这么长时间? enter image description here

最佳答案

试试这个:

ob_start();
//Your code to generate the output
$result = ob_get_contents(); //save the contents of output buffer to a string
ob_end_clean();
echo $result;

它对我来说运行得很快。

关于php - ob_flush 需要很长时间才能执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13903970/

相关文章:

php - 自定义 header 在 PHP 中给出 CORS 错误

c# - 将数组中的值与数组中之前的所有值进行比较的有效方法

python - 检查列表中是否存在值的最快方法

php - 我的自定义 Drupal 站点无法正确解析 URI

drupal-7 - 如何设置Drupal多语言站点?

Drupal: "All languages"作为多语言站点中的默认别名语言

php - IP 记帐到 SQL 数据库

PHP/MySQL 使用变量和 INSERT INTO 语法

php - 一页可处理带有参数的不同URL

ios - iOS Cordova 应用程序上的键盘响应缓慢