可以想像
ob_start()是说:“开始记住通常会输出的所有内容,但还没有做任何事情。”
例如:
ob_start();echo("Hello there!"); //would normally get printed to the screen/output to browser$output = ob_get_contents();ob_end_clean();您通常将其与其他两个功能配对:
ob_get_contents(),基本上可以为您提供自使用缓冲区打开以来已“保存”到缓冲区的所有内容
ob_start(),然后是
ob_end_clean()或
ob_flush(),它可以停止保存内容并丢弃已保存的内容,或者停止保存并一次全部输出。



