我获取的数据是这样的这是xml数据
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<p237:getNewSampleSerialNumsOutput xmlns:p237="http://www.cat.com/sos/2008/07/15/EquipmentService/">
<Equipment>
<p463:serialNumber xmlns:p463="http://www.cat.com/dds/Equipment/2008/07/15">ZBD11674</p463:serialNumber>
<p463:make xsi:nil="true" xmlns:p463="http://www.cat.com/dds/Equipment/2008/07/15"/>
</Equipment>
<Equipment>
<p463:serialNumber xmlns:p463="http://www.cat.com/dds/Equipment/2008/07/15">ZBF11179</p463:serialNumber>
<p463:make xsi:nil="true" xmlns:p463="http://www.cat.com/dds/Equipment/2008/07/15"/>
</Equipment>
<Equipment>
<p463:serialNumber xmlns:p463="http://www.cat.com/dds/Equipment/2008/07/15">ZBF11507</p463:serialNumber>
<p463:make xsi:nil="true" xmlns:p463="http://www.cat.com/dds/Equipment/2008/07/15"/>
</Equipment>
</p237:getNewSampleSerialNumsOutput>
</soapenv:Body>
</soapenv:Envelope>
然后我想要根据标签Equipment把他们截取成一个数组(内容和标签一起获取)【实在不行不拿标签也行,我自己加上去】
然后代码是这样
preg_match_all('/<Equipment>.*<\/Equipment>/',$res,$a);
但是获取的却是截取第一个<Equipment>到最后一个</Equipment>,中间的区域都不去识别
请问有什么优化的方法吗
- 3 回答
- 0 关注
- 543 浏览
添加回答
举报
0/150
提交
取消