❮ PHP Output Control Functions
Store the contents of an output buffer in a variable:
<?php
ob_start();
echo "Hello World!";
$contents = ob_get_contents();
ob_end_clean();
echo "The contents of the buffer are: ";
echo $contents;
?>
Try it Yourself »
The ob_get_contents()
function returns the contents of the topmost output buffer.
ob_get_contents();
Return Value: | Returns a string containing the contents of the buffer |
---|---|
PHP Version: | 4.3+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!