PHP parse_ini_string() 함수
❮ PHP 파일 시스템 참조예시
ini 문자열을 구문 분석합니다.
$ini = '
[names]
me = "Robert"
you = "Peter"
[urls]
first = "http://www.example.com"
second = "https://www.w3schools.com"
';
print_r(parse_ini_string($ini));
위 코드의 출력은 다음과 같습니다.
Array
(
[names] => Array
(
[me] => Robert
[you] => Peter
)
[urls] => Array
(
[first] => http://www.example.com
[second] => https://www.w3schools.com
)
)
정의 및 사용
parse_ini_file() 함수는 구성(ini) 문자열을 구문 분석하고 설정을 반환합니다.
팁: 이 기능은 자신의 구성 파일을 읽는 데 사용할 수 있으며 php.ini 파일과 관련이 없습니다.
참고: null, yes, no, true, false, on, off, none과 같은 예약어를 ini 파일의 키로 사용해서는 안 됩니다. 또한 다음 예약 문자를 키에 사용해서는 안 됩니다. {}|&~!()^".
통사론
parse_ini_string(ini, process_sections, scanner_mode)
매개변수 값
Parameter | Description |
---|---|
ini | Required. Specifies the ini file to parse |
process_sections | Optional. If set to TRUE, it returns is a multidimensional array with section names and settings included. Default is FALSE |
scanner_mode |
Optional. Can be one of the following values:
|
기술적 세부 사항
반환 값: | 성공 시 배열, 실패 시 FALSE |
---|---|
PHP 버전: | 5.3+ |
❮ PHP 파일 시스템 참조