1

我正在尝试将此 xml 文件解析为 php。

http://www.san-isidro.net/appmovil/partenieve.xml

问题是我不知道用 mysqldump 获得的这种 xml 格式进行解析。

你能帮我解析<field name="observaciones">php吗?

4

1 回答 1

1

你需要simplexml_load_file()在 PHP上演练

您的代码将是这样的

<?php
$xml = simplexml_load_file('http://www.san-isidro.net/appmovil/partenieve.xml');
print_r($xml);

输出:

SimpleXMLElement 对象([数据库] => SimpleXMLElement 对象([@attributes] => 数组([名称] => sanisidro)[table_structure] => SimpleXMLElement 对象([@attributes] => 数组([名称] => nuke_partenieve)[ field] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [Field] => id [Type] => int(10) [Null] => NO [Key] => PRI [默认] => 0 [Extra] => [Comment] => ) ) 1 => SimpleXMLElement Object ([@attributes] => Array ([Field] => date [Type] => date [Null] => NO [ Key] => [Default] => 0000-00-00 [Extra] => [Comment] => ) ) [2] => SimpleXMLElement Object ([@attributes] => Array ([Field] => espesor_max [Type ] => text [Null] => NO [Key] =>......

于 2013-10-06T08:13:37.827 回答