PHP从stdclass对象获取特定值

时间:2016-07-19 05:46:45

标签: php

当我print_r();

时,我有这样的输出
(
    [WebTransactionResult] => stdClass Object
        (
            [AmountBalance] => 0
            [AmountLoaded] => 0
            [CardNumber] => 60016400000256
            [CardRefNumber] => 
            [CardType] => 
            [Currency] => 
            [CurrentTier] => Silver Loyalty
            [CustomerFirstName] => Member
            [RedeemItem] => 
            [ResponseCode] => 0
            [ResponseMessage] => Success
            [ReversedTransactionIds] => 
            [SequenceCode] => 
            [StoreId] => 1721
            [SuccessTransactionIds] => 
            [TerminalId] => 4377
            [TotalAmountBalance] => 0

        )

)

我只想打印[TotalAmountBalance]的值我应该怎么做?同样的方式我想分别打印每个值。请帮忙

1 个答案:

答案 0 :(得分:2)

尝试:

echo $objData->WebTransactionResult->TotalAmountBalance;