Advertisement
iEmanuele

Output Buffer

Mar 2nd, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. /**
  2.  * Caso: no output buffer ( ob )
  3.  *
  4.  **/
  5. $html = '';
  6.  
  7. /* computazione */
  8.  
  9. $html .= '<div>';
  10. $html .= '<img src="" />';
  11. $html .= '</div>';
  12.  
  13. return $html;
  14.  
  15. /**
  16.  * Caso: output buffer ( cattura e restituzione )
  17.  *
  18.  **/
  19.  
  20. /* computazione */
  21.  
  22. ob_start();
  23.  
  24. //Chiudo PHP
  25.  
  26. // <div><img src="" /></div>
  27.  
  28. //Riapro PHP
  29.  
  30. return ob_get_clean();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement