執行時配置
這些函式的行為受 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 |
這是配置指令的簡短說明。
-
allow_url_fopen
bool -
本選項啟用了 URL 形式的 fopen 封裝協議使得可以訪問 URL 對像例如檔案。預設的封裝協議提供用 ftp 和 http 協議來訪問遠端檔案,一些擴充套件庫例如 zlib 可能會註冊更多的封裝協議。
-
allow_url_include
bool -
This option allows the use of URL-aware fopen wrappers with the following functions: include, include_once, require, require_once.
注意:
這個設定項需要開啟 allow_url_fopen 。
-
user_agent
string -
定義 PHP 發送的 User-Agent。
-
default_socket_timeout
int -
指定基於 socket 的流的預設超時時間(秒)。指定一個負值意味著不會超時。
-
from
string -
這個 email 地址在使用 ftp 封裝器的時候用於未認證的 FTP 連線,在使用 http 封裝器的時候用於 HTTP 連線的訊息頭中的 From 欄位。
-
auto_detect_line_endings
bool -
當設為 On 時,PHP 將檢查通過 fgets() 和 file() 取得的數據中的行結束符號是符合 Unix,MS-DOS,還是 Macintosh 的習慣。
這使得 PHP 可以和 Macintosh 系統互動操作,但是預設值是 Off,因為在檢測第一行的 EOL 習慣時會有很小的效能損失,而且在 Unix 系統下使用回車符號作為專案分隔符的人們會遭遇向下不相容的行為。
-
sys_temp_dir
string -