ob_get_length

(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)

ob_get_length返回输出缓冲区内容的长度

说明

ob_get_length(): int|false

将返回输出缓冲区内容的长度,单位为字节。

参数

此函数没有参数。

返回值

返回输出缓冲区内容的长度,单位为字节;如果缓冲区无效,则返回 false

范例

示例 #1 ob_get_length() 的简单示例

<?php

ob_start
();

echo
"Hello ";

$len1 = ob_get_length();

echo
"World";

$len2 = ob_get_length();

ob_end_clean();

echo
$len1 . ", " . $len2;
?>

以上例程会输出:

6, 11

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top