Guest User

Untitled

a guest
Jul 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public function testSomething (){
  2. ob_start();
  3. $class = new MyClass();
  4. $class->method();
  5. ob_clean();
  6. }
  7.  
  8. <?php
  9. public function testSomething (){
  10. ob_start();
  11. ob_implicit_flush(false); // turn off implicit flush
  12.  
  13. // Make your output below
  14. $class = new MyClass();
  15. $class->method();
  16. // End of output
  17.  
  18. // store output into variable:
  19. $output = ob_get_contents();
  20. }
  21. ?>
  22.  
  23. ob_implicit_flush(false);
  24. ob_start();
  25. /*
  26. ...
  27. ... do something that pushes countent to the output buffer
  28. ...
  29. */
  30. $rendered = ob_get_contents();
  31. ob_end_clean(); // Needed to clear the buffer
Add Comment
Please, Sign In to add comment