Home  >  Article  >  Backend Development  >  A small example of php output buffering

A small example of php output buffering

WBOY
WBOYOriginal
2016-07-25 08:56:031073browse
  1. //开启缓冲

  2. ob_start();

  3. // Output stuff (probably not this simple, might be custom CMS functions...

  4. echo 'Print to the screen!!!';

  5. // Get value of buffering so far

  6. $getContent = ob_get_contents();

  7. // Stop buffering

  8. ob_end_clean();

  9. // Do stuff to $getContent as needed

  10. // Use it

  11. echo 'Now: ' . $getContent;
  12. ?>

复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn