INDEX

PHP - xml file - simplexml_load_file - search item

The contents of the element search and displays.

(xml filename: items.xml)
< ?xml version="1.0" encoding="utf-8"?>
< root>
  < item1>this is item1.
  < item2>this is item2.
  < item3>this is item3.
  < item4>this is item4.
< /root>

(php code)
< ?
$xml_data = simplexml_load_file("items.xml");
$item = $xml_data->item3;
print $item;
?>

(Result)
this is item3.


Copyright(c) 2007-2020 coding.dojeun.com All Rights Reserved.