以下XML是SOAP返回的,第一接触这个,想问一下,以代码如何用PHP进行解析出我想要的,比如:DateNumber,PrizeNumber,PrizeTime这个的值,请高手帮忙解决一下.谢谢了
还有他这个日期中间怎么会有一个T呢.这个T表示什么意思?<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<DateNumber>20110407001</DateNumber>
<PrizeNumber>12345</PrizeNumber>
<PrizeTime>2011-04-07T23:14:00+08:00</PrizeTime>
</Table>
</NewDataSet>
</diffgr:diffgram>
还有他这个日期中间怎么会有一个T呢.这个T表示什么意思?<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<DateNumber>20110407001</DateNumber>
<PrizeNumber>12345</PrizeNumber>
<PrizeTime>2011-04-07T23:14:00+08:00</PrizeTime>
</Table>
</NewDataSet>
</diffgr:diffgram>
http://www.php.net/manual/zh/book.dom.php
{
$array = (array)(simplexml_load_string($xmlContent));
foreach ($array as $key=>$item){
$array[$key] = struct_to_array((array)$item);
}
return $array;
}function struct_to_array($item) {
if(!is_string($item)) {
$item = (array)$item;
foreach ($item as $key=>$val){
$item[$key] = struct_to_array($val);
}
}
return $item;
}$xmlContent= '你的xml文件内容';$arr=xml_to_array($xmlContent);
var_dump($arr);