PHP SimpleXML 函数 详解

解析xml文档的数据

1、simplexml_load_string :将xml内容转换为对象

simplexml_load_string — Interprets a string of XML into an object
SimpleXMLElement 对象

2、asXML() 函数

以字符串的形式从 SimpleXMLElement 对象返回 XML 文档。

<?php
if (file_exists('test.xml'))
  {
  $xml = simplexml_load_file('test.xml');
  }

echo $xml->asXML();
?>

3、

猜你喜欢

转载自blog.csdn.net/eddy23513/article/details/81077535