PHPのflush()関数
例
スクリプトの実行が終了する前に、ブラウザに文字列を出力します。
<?php
// Some browsers will not display the content if it is too short
// We use str_pad() to make the output long enough
echo str_pad("Hello
World!", 4096);
// Use flush() to send the string to the browser
flush();
// Display the rest of the content three seconds later
sleep(3);
echo "<br>";
echo "Hello World!";
?>
定義と使用法
このflush()
関数は、現在バッファリングされている出力をブラウザに送信するようサーバーに要求します。サーバー構成では、これが常に発生するとは限りません。
構文
flush();
技術的な詳細
PHPバージョン: | 4歳以上 |
---|
❮PHP出力制御関数