這些函數的行為受 php.ini 中的設置影響。
名字 | 默認 | 可修改范圍 | 更新日志 |
---|---|---|---|
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
本選項激活了 URL 形式的 fopen 封裝協(xié)議使得可以訪(fǎng)問(wèn) URL 對象例如文件。默認的封裝協(xié)議提供用 ftp 和 http 協(xié)議來(lái)訪(fǎng)問(wèn)遠程文件,一些擴展庫例如 zlib 可能會(huì )注冊更多的封裝協(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è)設置項需要開(kāi)啟 allow_url_fopen 。
user_agent
string
定義 PHP 發(fā)送的 User-Agent。
default_socket_timeout
int
指定基于 socket 的流的默認超時(shí)時(shí)間(秒)。指定一個(gè)負值意味著(zhù)不會(huì )超時(shí)。
from
string
這個(gè) email 地址在使用 ftp 封裝器的時(shí)候用于未認證的 FTP 連接,在使用 http 封裝器的時(shí)候用于 HTTP 連接的消息頭中的 From 字段。
auto_detect_line_endings
bool
當設為 On 時(shí),PHP 將檢查通過(guò) fgets() 和 file() 取得的數據中的行結束符號是符合 Unix,MS-DOS,還是 Macintosh 的習慣。
這使得 PHP 可以和 Macintosh 系統交互操作,但是默認值是 Off,因為在檢測第一行的 EOL 習慣時(shí)會(huì )有很小的性能損失,而且在 Unix 系統下使用回車(chē)符號作為項目分隔符的人們會(huì )遭遇向下不兼容的行為。
sys_temp_dir
string