1

我需要解析下面的数组并检索值;状态,id。

下面是 PHP 数组

Array ( [0] => CyberSource\Model\PtsV2PaymentsPost201Response Object ( [container:protected] => 
Array ( [links] => CyberSource\Model\PtsV2PaymentsPost201ResponseLinks Object ( [container:protected] => 
    Array ( [self] => CyberSource\Model\PtsV2PaymentsPost201ResponseLinksSelf 
        Object ( [container:protected] => Array ( [href] => /pts/v2/payments/621258854395 [method] => GET ) )
        [reversal] => [capture] => [customer] => [paymentInstrument] => [shippingAddress] => [instrumentIdentifier] => ) ) 
        [id] => 621258854395 
        [submitTimeUtc] => 2021-05-17T13:40:55Z 
        [status] => AUTHORIZED 
        [reconciliationId] => 621258854395 
        [errorInformation] =>...............

下面是我的php代码

 $parseApiResponse = new CyberSource\Model\PtsV2PaymentsPost201Response($apiResponse);
    print_r("Status"." ".$parseApiResponse->getStatus()); 

请协助解决此问题。

想做和我在java中可以做的类似的事情,如下所示

  String status = result.getStatus();
4

1 回答 1

0

$parseApiResponse = new Cyber​​Source\Model\PtsV2PaymentsPost201Response($apiResponse);

$result = \GuzzleHttp\json_decode( $parseApiResponse[0] , true );

return = $result['links'];

于 2021-10-25T01:52:04.023 回答