日期:2014-05-16 浏览次数:20427 次
<?xml version="1.0" encoding="GBK"?>
<stream><MSGCODE>AAAAAAA</MSGCODE><MSGCN>交易成功!</MSGCN><B2CCERTNO>500415</B2CCERTNO><ORDERDATE>2013-11-21</ORDERDATE><ORDERTIME>09:52:23</ORDERTIME><ORDERNO>DGM20131121000009</ORDERNO><ORDERAMT>6.26</ORDERAMT><CURRID>01</CURRID><PAYAMT>6.26</PAYAMT><PAYNO>BC131121095428004271</PAYNO><ACCNO>6226********6770</ACCNO><ACCTYPE>01</ACCTYPE><PBCSTNAME>测试</PBCSTNAME><ACCHASH>fSSczJM0fims1Xpmrvi2pnBtrr4=</ACCHASH></stream>
$string = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<stream><MSGCODE>AAAAAAA</MSGCODE><MSGCN>交易成功!</MSGCN><B2CCERTNO>500415</B2CCERTNO><ORDERDATE>2013-11-21</ORDERDATE><ORDERTIME>09:52:23</ORDERTIME><ORDERNO>DGM20131121000009</ORDERNO><ORDERAMT>6.26</ORDERAMT><CURRID>01</CURRID><PAYAMT>6.26</PAYAMT><PAYNO>BC131121095428004271</PAYNO><ACCNO>6226********6770</ACCNO><ACCTYPE>01</ACCTYPE><PBCSTNAME>测试</PBCSTNAME><ACCHASH>fSSczJM0fims1Xpmrvi2pnBtrr4=</ACCHASH></stream>
XML;
preg_match_all('#<(MSGCODE
------解决方案--------------------
ORDERNO)>(.+)</\1#s',$string,$m);
print_r($m);