php中的simplexml_load_string函数将xml格式字符串转换为对应的SimpleXMLElement
对象。
例如:
$note=<<<XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
XML;
$xml=simplexml_load_string($note);
print_r($xml);
结果为:
SimpleXMLElement Object
(
[to] => Tove
[from] => Jani
[heading] => Reminder
[body] => Don't forget me this weekend!
)
网友评论