首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ob_get_flush

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

ob_get_flush — Flush the output buffer, return it as a string and turn off output buffering

Description

代码语言:javascript
复制
string ob_get_flush ( void )

ob_get_flush() flushes the output buffer, return it as a string and turns off output buffering.

The output buffer must be started by ob_start() with PHP_OUTPUT_HANDLER_FLUSHABLE flag. Otherwise ob_get_flush() will not work.

Note: This function is similar to ob_end_flush(), except that this function also returns the buffer as a string.

Return Values

Returns the output buffer or FALSE if no buffering is active.

Examples

Example #1 ob_get_flush() example

代码语言:javascript
复制
<?php
//using output_buffering=On
print_r(ob_list_handlers());

//save buffer in a file
$buffer = ob_get_flush();
file_put_contents('buffer.txt', $buffer);

print_r(ob_list_handlers());
?>

The above example will output:

代码语言:javascript
复制
Array
(
    [0] => default output handler
)
Array
(
)

See Also

  • ob_end_clean() - Clean (erase) the output buffer and turn off output buffering
  • ob_end_flush() - Flush (send) the output buffer and turn off output buffering
  • ob_list_handlers() - List all output handlers in use

← ob_get_contents

ob_get_length →

代码语言:txt
复制
 © 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券