PHP 8.0.24 Released!


这些函数的行为受 php.ini 中的设置影响。

名字 默认 可修改范围 更新日志
output_buffering "0" PHP_INI_PERDIR  
output_handler NULL PHP_INI_PERDIR  
implicit_flush "0" PHP_INI_ALL  
url_rewriter.tags "a=href,area=href,frame=src,form=,fieldset=" PHP_INI_ALL Before PHP 7.1.0, this was used to set session's trans sid rewrite. From PHP 7.1.0, it is only used by output_add_rewrite_var().
url_rewriter.hosts $_SERVER['HTTP_HOST'] is used as default. PHP_INI_ALL Available as of PHP 7.1.0
有关 PHP_INI_* 样式的更多详情与定义,见 配置可被设定范围


output_buffering bool/int

该选项设置为 On 时,将在所有的脚本中使用输出控制。如果要限制输出缓冲区的最大值,可将该选项设定为指定的最大字节数(例如 output_buffering=4096)。从PHP 该选项在 PHP-CLI 下总是为 Off。

output_handler string

该选项可将脚本所有的输出,重定向到一个函数。例如,将 output_handler 设置为 mb_output_handler() 时,字符的编码将被修改为指定的编码。设置的任何处理函数,将自动的处理输出缓冲。


不能同时使用 mb_output_handler()ob_iconv_handler(),也不能同时使用 ob_gzhandler()zlib.output_compression


只有内置函数可以使用此指令。对于用户定义的函数,使用 ob_start()

implicit_flush bool

默认为 false。如将该选项改为 true,PHP 将使输出层,在每段信息块输出后,自动刷新。这等同于在每次使用 printecho 等函数或每个 HTML 块之后,调用 PHP 中的 flush() 函数。

不在web环境中使用 PHP 时,打开这个选项对程序执行的性能有严重的影响,通常只推荐在调试时使用。在 CLI SAPI 的执行模式下,该标记默认为 true

参见 ob_implicit_flush()

url_rewriter.tags string
url_rewriter.tags specifies which HTML tags are rewritten by output_add_rewrite_var() values. Defaults to a=href,area=href,frame=src,input=src,form= form is special tag. <input hidden="session_id" name="session_name"> is added as form variable.

注意: Before PHP 7.1.0, url_rewriter.tags was used to specify session.trans_sid_tags. As of PHP 7.1.0, fieldset is no longer considered as special tag.

url_rewriter.hosts string
url_rewriter.hosts specifies which hosts are rewritten to include output_add_rewrite_var() values. Defaults to $_SERVER['HTTP_HOST']. Multiple hosts can be specified by ",", no space is allowed between hosts. e.g.,,

add a note

User Contributed Notes 1 note

support at losalgendesign dot com
9 years ago
Using "OFF" or no value on output_buffering will disable header modifications, like redirects or content-type or content-disposition resulting in the error we commonly attribute to output before header modifications:

Warning: Cannot modify header information - headers already sent by (output started at C:\PATH\filename.php:1) C:\PATH\filename.php on line 1

Example code with output_buffering = OFF which results in this behavior.  Changing it to "ON" or giving it a value will likely cause normal behavior.

<?php header("Location:"); ?>


<?php header("Content-Type: text/Calendar"); ?>
<?php header
("Content-Disposition: inline; filename=appointment.ics"); ?>
To Top