Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function testSomething (){
- ob_start();
- $class = new MyClass();
- $class->method();
- ob_clean();
- }
- <?php
- public function testSomething (){
- ob_start();
- ob_implicit_flush(false); // turn off implicit flush
- // Make your output below
- $class = new MyClass();
- $class->method();
- // End of output
- // store output into variable:
- $output = ob_get_contents();
- }
- ?>
- ob_implicit_flush(false);
- ob_start();
- /*
- ...
- ... do something that pushes countent to the output buffer
- ...
- */
- $rendered = ob_get_contents();
- ob_end_clean(); // Needed to clear the buffer
Add Comment
Please, Sign In to add comment