(PHP 5 >= 5.3.0, PHP 7, PHP 8)
parse_ini_string — 解析配置字符串
$ini, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array
parse_ini_string() 返回 ini 字符串解析后的關聯數組
ini 字符串的格式參考 php.ini
iniini 字符串內容
process_sections
設置 process_sections 參數為 true,得到一個多維數組,包含名稱和設置。process_sections 默認為 false
scanner_mode
可以是 INI_SCANNER_NORMAL (默認)或 INI_SCANNER_RAW 。如果是 INI_SCANNER_RAW,那么選項值不會被解析。
As of PHP 5.6.1 can also be specified as INI_SCANNER_TYPED.
In this mode boolean, null and integer types are preserved when possible.
String values "true", "on" and "yes"
are converted to true. "false", "off", "no"
and "none" are considered false. "null" is converted to null
in typed mode. Also, all numeric strings are converted to integer type if it is possible.
執(zhí)行成功返回一個關聯數組,返回 false 為失敗
注意: 保留關鍵字不能作為 ini 的鍵,包括 null, yes, no, true, false, on, off, none以及空值,off,no 和錯誤的結果集,值為 yes 和 正確的結果集。除非使用
INI_SCANNER_TYPED模式。 字符?{}|&~![()^"不能在任何地方使用作為鍵和有特殊意義的值。