PHP flush() Functie
❮ PHP-uitvoerbesturingsfuncties
Voorbeeld
Voer een tekenreeks uit naar de browser voordat het script is uitgevoerd:
<?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!";
?>
Definitie en gebruik
De flush()
functie vraagt de server om de momenteel gebufferde uitvoer naar de browser te sturen. De serverconfiguratie staat dit mogelijk niet altijd toe.
Syntaxis
flush();
Technische details
PHP-versie: | 4+ |
---|
❮ PHP-uitvoerbesturingsfuncties