码迷,mamicode.com
首页 > 其他好文 > 详细

正则表达式截取xml

时间:2017-09-29 22:45:31      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:bank   nat   encode   hang   spm   time   eid   result   code   

$str = ‘<Ips><GateWayRsp><head><ReferenceID>123</ReferenceID><RspCode>000000</RspCode><RspMsg><![CDATA[成功]]></RspMsg><ReqDate>20170928102447</ReqDate><RspDate></RspDate><Signature>eed5b1e42d5a5fb0a6ef569ccec76cef</Signature></head><body><MerBillNo>201709250000010947-iMcL2O9jx</MerBillNo><CurrencyType>156</CurrencyType><Amount>0.02</Amount><ExchangeRate>1</ExchangeRate><RMBAmount>0.02</RMBAmount><Date>20170928</Date><Status>Y</Status><Msg><![CDATA[支付成功!]]></Msg><Attach><![CDATA[Fannie]]></Attach><IpsBillNo>BO20170928102638023091</IpsBillNo><IpsTradeNo>2017092810570071678</IpsTradeNo><RetEncodeType>17</RetEncodeType><BankBillNo>7110862177</BankBillNo><ResultType>0</ResultType><IpsBillTime>20170928105909</IpsBillTime></body></GateWayRsp></Ips>‘;
preg_match(‘/(?<=<\/head>)(.*)(?=<\/GateWayRsp>)/‘, $str, $match);

正则表达式截取xml

标签:bank   nat   encode   hang   spm   time   eid   result   code   

原文地址:http://www.cnblogs.com/fengliang/p/7612845.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!