session_start() by default generates a cookie to store the session id. Therefore
can be confusing.wyrmmage wrote:you must use the ob_start(); function (preferable after you use session_start().
The "header() statement" in your example isn't one. It's within the string literal and will be printed as-is in the document, it has no special meaning and will not generate a http header. Both scripts will work without errors/warnings.
And even if it does generate a header - e.g. let's take the script
Code: Select all
<?php
session_start();
ob_start();
echo'
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>';
header("Location: index.php");
echo ' </BODY>
</HTML>';
?>right, thats done even without the ob_* functions. http headers are stored and will be sent right before the first character f the response body is senttimvw wrote:The ob_* stuff will not buffer the output generated http headers