php对xml的处理

$paymentResult  =

$ips='<Ips><GateWayRsp><head><ReferenceID></ReferenceID><RspCode>000000</RspCode><RspMsg><![CDATA[交易成功!]]></RspMsg><ReqDate>20160613144542</ReqDate><RspDate>20160613144627</RspDate><Signature>1c377812dfb935a3dd8934ac455dfb3f</Signature></head><body><MerBillNo>7775020160613024838921</MerBillNo><CurrencyType>156</CurrencyType><Amount>1950</Amount><Date>20160613</Date><Status>Y</Status><Msg><![CDATA[支付成功!]]></Msg><Attach><![CDATA[wjg201518_Andy_536354]]></Attach><IpsBillNo>BO2016061314454224926</IpsBillNo><IpsTradeNo>2016061302064237978</IpsTradeNo><RetEncodeType>17</RetEncodeType><BankBillNo>7108288387</BankBillNo><ResultType>0</ResultType><IpsBillTime>20160613144627</IpsBillTime></body></GateWayRsp></Ips>';

 

$xml=simplexml_load_string($paymentResult,'SimpleXMLElement', LIBXML_NOCDATA);

  $post = array();
   //读取相关xml中信息
  $RspCodesx = $xml->xpath("GateWayRsp/head/RspCode");//响应编码
  $RspCode = $RspCodesx[0];
  $errCode = (array)$RspCode ;
  $post['errCode'] = $errCode[0] ;

上一篇:Json.Net学习(1) 实现简单的序列化和反序列化


下一篇:android147 360 程序锁