0

I have one file will include other files depending on some conditions, One of these files needs to use output buffering so that the response can be returned to the browser and then some slow actions performed after.

If I run the file that I want to use output buffering directly it works correctly, but If I include this file in another it doesn't work.

For example:

the file that includes: (doesn't work)

if($action == 'blah'){
    require_once 'blah.php';       
}

blah.php: (works if called directly)

ob_start();
$buffer = ob_get_contents();
ob_clean();

header('Location: http://www.google.com');

ignore_user_abort(true);
ob_end_flush();

flush();

//Do slow stuff

How can I get this to work?

Chris
  • 3,036
  • 5
  • 36
  • 53

0 Answers0