運(yùn)行時(shí)配置

這些函數(shù)的行為受 php.ini 中的設(shè)置影響。

輸出控制配置選項(xiàng)
名字 默認(rèn) 可修改范圍 更新日志
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
有關(guān) PHP_INI_* 樣式的更多詳情與定義,見 配置可被設(shè)定范圍。

這是配置指令的簡短說明。

output_buffering bool/int

該選項(xiàng)設(shè)置為 On 時(shí),將在所有的腳本中使用輸出控制。如果要限制輸出緩沖區(qū)的最大值,可將該選項(xiàng)設(shè)定為指定的最大字節(jié)數(shù)(例如 output_buffering=4096)。從PHP 該選項(xiàng)在 PHP-CLI 下總是為 Off。

output_handler string

該選項(xiàng)可將腳本所有的輸出,重定向到一個(gè)函數(shù)。例如,將 output_handler 設(shè)置為 mb_output_handler() 時(shí),字符的編碼將被修改為指定的編碼。設(shè)置的任何處理函數(shù),將自動(dòng)的處理輸出緩沖。

注意:

不能同時(shí)使用 mb_output_handler()ob_iconv_handler(),也不能同時(shí)使用 ob_gzhandler()zlib.output_compression。

注意:

只有內(nèi)置函數(shù)可以使用此指令。對(duì)于用戶定義的函數(shù),使用 ob_start()。

implicit_flush bool

默認(rèn)為 false。如將該選項(xiàng)改為 true,PHP 將使輸出層,在每段信息塊輸出后,自動(dòng)刷新。這等同于在每次使用 printecho 等函數(shù)或每個(gè) HTML 塊之后,調(diào)用 PHP 中的 flush() 函數(shù)。

不在web環(huán)境中使用 PHP 時(shí),打開這個(gè)選項(xiàng)對(duì)程序執(zhí)行的性能有嚴(yán)重的影響,通常只推薦在調(diào)試時(shí)使用。在 CLI SAPI 的執(zhí)行模式下,該標(biāo)記默認(rèn)為 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. php.net,wiki.php.net,bugs.php.net