1. <?php
  2. // 빈공간(스페이스바 ) 에러나서 붙였음
  3. $string = <<<XML
  4. <?xml version='1.0'?> 
  5. <document>
  6.  <title>Forty What?</title>
  7.  <from>Joe</from>
  8.  <to>Jane</to>
  9.  <body>
  10.   I know that's the answer -- but what's the question?
  11.  </body>
  12. </document>
  13. XML;

  14. $xml = simplexml_load_string($string);

  15. print_r($xml);
  16. /* xml 출력
  17.   SimpleXMLElement Object
  18.   (
  19.     [title] => Forty What?
  20.     [from] => Joe
  21.     [to] => Jane
  22.     [body] =>
  23.      I know that's the answer -- but what's the question?
  24.   )
  25. */
  26. ?>

--------------------------------------------------------------------------------------------


SimpleXMLElement simplexml_load_string ( string $data [, string $class_name = "SimpleXMLElement" [, int $options = 0 [, string $ns = "" [, bool $is_prefix = false ]]]] )


3. 라인 

$data의 xml 데이터를 배열로 반환합니다.


※xml 데이터의 파일이나 url로 읽는 simplexml_load_file()함수도 있습니다.

:
BLOG main image

공지사항

카테고리

분류 (356)
main (1)
php5 (218)
HTML (36)
javascript (93)
IT 이론과 퍼온정보 (8)
깨작일상 (0)
곧 추가할 내용 (0)
추후 알아볼것들... (0)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

달력

«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Total :
Today : Yesterday :