嗨,我得到了这个功能:
public static function consumeMessage($xml, $debug = 1) {
$xml = stripslashes(urldecode($xml));
$rq = OpenPayU::parseOpenPayUDocument($xml);
$msg = $rq['OpenPayU']['OrderDomainRequest'];
switch (key($msg)) {
case 'OrderNotifyRequest':
return OpenPayU_Order::consumeNotification($xml);
break;
case 'ShippingCostRetrieveRequest':
return OpenPayU_Order::consumeShippingCostRetrieveRequest($xml);
break;
default:
return key($smg);
break;
}
}
我这样称呼:
$result = OpenPayU_Order::retrieve($result->sessionId);
并以这种方式写入文件:
write_to_file("debug.txt", "order details: \n\n " .
serialize($result->response) . "\n\n");
在我得到的输出中:
a:1:{s:8:"OpenPayU";a:2:{s:14:"HeaderResponse";a:3:{s:10:"SenderName";s:8:"checkout";s:7 :"版本";s:3:"1.0";s:9:"算法";s:3:"MD5";}s:19:"OrderDomainResponse";a:1:{s:21:"OrderRetrieveResponse" ;a:8:{s:5:"ResId";s:32:"28444ffd9de5489e08a32e6cd51274a5";s:6:"状态";a:1:{s:10:"StatusCode";s:16:"OPENPAYU_SUCCESS" ;}s:13:"MerchantPosId";s:5:"37857";s:9:"SessionId";s:32:"55a6d45cc0fef40ce95e9c1321b19b13";s:14:"CustomerRecord";a:6:{s:10 :"CustomerId";s:8:"nyi3iw6v";s:5:"Email";s:28:"netprofile@netprofile.com.pl";s:5:"电话";s:15:"(+ 48) 786265656";s:9:"FirstName";s:5:"mieta";s:8:"姓氏";s:5:"mieta";s:8:"语言";s:2:"pl";}s:11:"OrderStatus";s:20:"ORDER_STATUS_PENDING";s:12 :"CurrencyCode";s:3:"PLN";s:7:"PayType";s:1:"t";}}}}
但是我需要将几乎每个值都分开,f.ex: 'StatusCode' 并将其保存到数据库中,有没有办法在没有正则表达式的情况下获得它?
我试着得到它像 $result->response['statuscode']; 但我什么也得不到