LXXIV. Output Control Functions
The Output Control functions allow you to control when output is
sent from the script. This can be useful in several different
situations, especially if you need to send headers to the browser
after your script has began outputing data. The Output Control
functions do not affect headers sent using
header() or setcookie(),
only functions such as echo() and data between
blocks of PHP code.
예 1. Output Control example <?php
ob_start();
echo "Hello\n";
setcookie ("cookiename", "cookiedata");
ob_end_flush();
?> |
|
In the above example, the output from echo()
would be stored in the output buffer until
ob_end_flush() was called. In the mean time,
the call to setcookie() successfully stored a
cookie without causing an error. (You can not normally send
headers to the browser after data has already been sent.)
See also header() and
setcookie().