[英]Parsing XML data using PHP
I need to parse all data from below XML file. 我需要从XML文件下面解析所有数据。 Please guide me how can I do it? 请指导我该怎么做? How can I put data into a separate variables or array. 如何将数据放入单独的变量或数组中。 Like, the value of <p:productid>
tag into $pid and value of <p1:devices>
into $pdevice? 例如,将<p:productid>
标记的值转换为$ pid,将<p1:devices>
标记的值转换为$ pdevice?
Here is a sample file: 这是一个示例文件:
<?xml version="1.0" encoding="UTF-8"?>
<p:application>
<p1:devices>
<p1:device>First device</p1:device>
<p1:device>Second Device</p1:device>
</p1:devices>
</p:versions>
</p:application>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.