总有人间一两风,填我十万八千梦

PHP ob_list_handlers 用法 手册 | 示例代码

PHP开发手册 归档 280℃ 0评论

ob_list_handlers

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

ob_list_handlers列出所有使用中的输出处理程序。

说明

ob_list_handlers ( void ) : array

列出所有使用中的输出处理程序。

返回值

此函数将返回一个数组,数组元素是正在使用中输出处理程序名(如果存在的输出处理程序的话)。 如果启用了output_buffering 或者在 ob_start() 中创建了一个匿名函数,ob_list_handlers() 将返回 "default output handler"。

范例

Example #1 ob_list_handlers() example

<?php
//using output_buffering=On
print_r(ob_list_handlers());
ob_end_flush();

ob_start("ob_gzhandler");
print_r(ob_list_handlers());
ob_end_flush();

// anonymous functions
ob_start(create_function('$string''return $string;'));
print_r(ob_list_handlers());
ob_end_flush();
?>

以上例程会输出:

Array
(
    [0] => default output handler
)

Array
(
    [0] => ob_gzhandler
)

Array
(
    [0] => default output handler
)

参见

  • ob_end_clean() – 清空(擦除)缓冲区并关闭输出缓冲
  • ob_end_flush() – 冲刷出(送出)输出缓冲区内容并关闭缓冲
  • ob_get_flush() – 刷出(送出)缓冲区内容,以字符串形式返回内容,并关闭输出缓冲区。
  • ob_start() – 打开输出控制缓冲

用户贡献的笔记

There are no user contributed notes for this page.

转载请注明:悠然品鉴 » PHP ob_list_handlers 用法 手册 | 示例代码

喜欢 (0)or分享 (0)
发表我的评论
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址