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

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

文件系統(tǒng)和流配置選項(xiàng)
名字 默認(rèn) 可修改范圍 更新日志
allow_url_fopen "1" PHP_INI_SYSTEM  
allow_url_include "0" PHP_INI_SYSTEM 自 PHP 7.4.0 起廢棄。
user_agent NULL PHP_INI_ALL  
default_socket_timeout "60" PHP_INI_ALL  
from "" PHP_INI_ALL  
auto_detect_line_endings "0" PHP_INI_ALL  
sys_temp_dir "" PHP_INI_SYSTEM  

這是配置指令的簡(jiǎn)短說(shuō)明。

allow_url_fopen bool

本選項(xiàng)激活了 URL 形式的 fopen 封裝協(xié)議使得可以訪問(wèn) URL 對(duì)象例如文件。默認(rèn)的封裝協(xié)議提供用 ftp 和 http 協(xié)議來(lái)訪問(wèn)遠(yuǎn)程文件,一些擴(kuò)展庫(kù)例如 zlib 可能會(huì)注冊(cè)更多的封裝協(xié)議。

allow_url_include bool

This option allows the use of URL-aware fopen wrappers with the following functions: include, include_once, require, require_once.

注意:

這個(gè)設(shè)置項(xiàng)需要開(kāi)啟 allow_url_fopen 。

user_agent string

定義 PHP 發(fā)送的 User-Agent。

default_socket_timeout int

指定基于 socket 的流的默認(rèn)超時(shí)時(shí)間(秒)。指定一個(gè)負(fù)值意味著不會(huì)超時(shí)。

from string

這個(gè) email 地址在使用 ftp 封裝器的時(shí)候用于未認(rèn)證的 FTP 連接,在使用 http 封裝器的時(shí)候用于 HTTP 連接的消息頭中的 From 字段。

auto_detect_line_endings bool

當(dāng)設(shè)為 On 時(shí),PHP 將檢查通過(guò) fgets()file() 取得的數(shù)據(jù)中的行結(jié)束符號(hào)是符合 Unix,MS-DOS,還是 Macintosh 的習(xí)慣。

這使得 PHP 可以和 Macintosh 系統(tǒng)交互操作,但是默認(rèn)值是 Off,因?yàn)樵跈z測(cè)第一行的 EOL 習(xí)慣時(shí)會(huì)有很小的性能損失,而且在 Unix 系統(tǒng)下使用回車符號(hào)作為項(xiàng)目分隔符的人們會(huì)遭遇向下不兼容的行為。

sys_temp_dir string