PHP xml_parse_into_struct() 함수
예시
XML 데이터를 배열로 구문 분석( note.xml 에서 ):
<?php
$xmlparser = xml_parser_create();
$fp = fopen("note.xml",
"r");
$xmldata = fread($fp, 4096);
// Parse XML data into an array
xml_parse_into_struct($xmlparser,$xmldata,$values);
xml_parser_free($xmlparser);
print_r($values);
fclose($fp);
?>
정의 및 사용
xml_parse_into_struct() 함수는 XML 데이터를 배열로 구문 분석합니다.
이 함수는 XML 데이터를 2개의 배열로 구문 분석합니다.
- 값 배열 - 구문 분석된 XML의 데이터 포함
- 인덱스 배열 - 값 배열의 값 위치에 대한 포인터 포함
통사론
xml_parse_into_struct(parser, data, values, index)
매개변수 값
Parameter | Description |
---|---|
parser | Required. Specifies the XML parser to use |
data | Required. Specifies the XML data to parse |
values | Required. Specifies an array with the values of the XML data |
index | Optional. Specifies an array with pointers to the location of the values in values |
기술적 세부 사항
반환 값: | 1 성공. 실패 시 0 |
---|---|
PHP 버전: | 4.0+ |
❮ PHP XML 파서 참조