PHP 中的某些进程在运行时会发送消息。
for ($i = 0; $i < 10; $i++) {
echo "message $i<br>";
sleep(3);
}
Run Code Online (Sandbox Code Playgroud)
但在此过程结束之前用户不会看到任何消息。PHP 中的输出缓冲被禁用。我是 Apache 服务器网络托管的客户。如何防止 .htaccess 中的输出缓冲?
在 PHP 中
ini_set('output_buffering', 0); - 没有效果ini_set('output_buffering', 'off');- 没有效果while(ob_end_flush()); flush(); - 没有效果ob_implicit_flush(true); ob_end_clean();- 没有效果在 .htaccess 中
php_flag output_buffering off - 没有效果php_value implicit_flush on- 没有效果仅适用于:
echo str_repeat(' ', 32768);
Run Code Online (Sandbox Code Playgroud)
但这太可怕了。