Hi,
When starting session_start() after ob_start(); there is always some unwanted crap code before the real output. When session_start() is before ob_start() it's ok.
Why?
| SitePoint Sponsor |
Hi,
When starting session_start() after ob_start(); there is always some unwanted crap code before the real output. When session_start() is before ob_start() it's ok.
Why?
case ob_start() starts writing all outputs into memory.
with ob_flush() you can send all of code from memory writed after ob_start().
but session_start() is starting session. It means not only send header to user, but it fetchs $_SESSION variables.
How I understend, if you start session_start() before ob_start(), $_SESSION variables in realy will fetch after ob_flush().
The problem was solved as follows;
But there is still this question; Why?PHP Code:<?php
ob_start();
//.......
ob_start();
session_start();
ob_end_flush();
//.......
ob_end_flush();
?>
Bookmarks