Zack Bloom wrote:
Sure, ob_start begins a buffer allowing you to display content in
the browser before your script has finished executing.

Calling ob_start() turns on PHP's output buffering. In other words, it buffers output from the moment this function is called until the buffer is flushed (whether explicitly or because the script finishes).

As long as PHP is buffering the output, the client can't get it.

This is useful when loading a time intensive page to tell the user
to  wait.

I think you might be thinking of flush(), which flushes PHP's output buffer as well as the output buffer of the web server (or whatever backend PHP is using).

When you create a session (provide php is not configured otherwise)
php attempts to store a cookie with the session id that corisponds
to  the session file on the server. If it cannot set this cookie it
appends the session id to pages in the get format.

Yeah, PHP includes a Set-Cookie header in its response. If session.use_trans_sid is enabled, it will also rewrite URLs to include the session identifier. When PHP receives a request that includes a session identifier, it knows whether the client accepts cookies.

if (session identifier in cookie)
{
    cookies enabled
}
elseif (session identifier in URL)
{
    cookies disabled
}
else
{
    new user
}

If you were to call session_start() after the output buffering,
content and consequentially the headers would have been already
sent to the browser.

Maybe you're getting the buffering and flushing concepts reversed? Think of a toilet - buffering is the handle up, and flushing is the handle down. :-)

Hope that helps!

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to