Re: [PHP] ob_start() -- ob_end_flush() problem
- Date: Thu, 27 Apr 2017 08:57:18 -0700
- From: David Harkness <david.h@xxxxxxxxxxxxxxxxx>
- Subject: Re: [PHP] ob_start() -- ob_end_flush() problem
On Thu, Apr 27, 2017 at 8:00 AM, Tedd Sperling <tedd@xxxxxxxxxxxx> wrote:
> Here’s the situation — I use ob_start() -- ob_end_flush() (see below) and
> my code works.
> However, when my students try it, even using my code, it doesn’t work for
How does it fail? Do they get double output? No output? Fatal error? Car
explodes? You're really not giving us much to go on here. :)
It looks like you're missing some important comments and--though it's early
and I may be a little groggy still--the function of ob_end_flush().
/* start buffered output */
/* capture buffered output */
$page = ob_get_contents();
> /* buffer captured buffered output */
> /* send buffered output and stop buffering */
Calling ob_get_contents() returns the current buffer *without clearing its
contents*. You then output that right back into the buffer. Finally,
calling ob_end_flush() outputs the current buffer and stops (that level of)
My guess is that "it doesn't work" means that the image is corrupted
because it's doubled in the response and you're using a browser that
handles that kind of image corruption.