If you want to have more control over your scripts, the output buffering functions are the way to go. Anything from error handling to multiple header() commands in a single document. Not only does output buffering offer a powerful API for handling content
Tutorial Details:
PHP Output Buffering
The output buffering functions of php aren't well known (yet), but are nevertheless extremely useful. These functions give you more control over the output generated by your scripts than you would normally have, and in some cases, this control is essential. Not only do you have control over when, where, and why your output is displayed, but you can also control how the output is handled. In this tutorial I hope to cover the general idea behind output buffering, as well as a few common uses.
Lets begin with a common problem, and an easy way to fix it. Some of you may notice this common mistake, because a lot of the people new to php have made it:
PHP Example: (!)
< html >
< body >
php
echo "You will now be directed to google.com...\n" ;
header ( "Location: http://www.google.com" );
?>
|