1

我想从数组中拉出一条记录并不断收到“致命错误:无法使用 stdClass 类型的对象作为数组”我做错了什么?

数组是 trxnResult。我正在尝试打印为:

  print $trxnResult['Bank_Resp_code'];

这是转储的一个片段:

        stdClass Object ( [ExactID] => xxxxx [Password] => [Transaction_Type] => 00 [DollarAmount] => 69.0 [SurchargeAmount] => [Card_Number] => ############1111 [Transaction_Tag] => 152425718 [Track1] => [Track2] => [PAN] => [Authorization_Num] => [Expiry_Date] => 1213 [CardHoldersName] => fdfd [VerificationStr1] => [VerificationStr2] => [CVD_Presence_Ind] => 0 [ZipCode] => [Tax1Amount] => [Tax1Number] => [Tax2Amount] => [Tax2Number] => [Secure_AuthRequired] => [Secure_AuthResult] => [Ecommerce_Flag] => [XID] => [CAVV] => [CAVV_Algorithm] => [Reference_No] => [Customer_Ref] => [Reference_3] => [Language] => [Client_IP] => 198.57.135.205 [Client_Email] => dfdf [User_Name] => [Currency] => USD [PartialRedemption] => [TransarmorToken] => [CardType] => Visa [EAN] => [VirtualCard] => [CardCost] => [Transaction_Error] => [Transaction_Approved] => [EXact_Resp_Code] => 00 [EXact_Message] => Transaction Normal [Bank_Resp_Code] => 201 
4

1 回答 1

3

您正在将对象视为数组。

这是解决方案:

print $trxnResult->Bank_Resp_code;

于 2013-09-30T18:47:07.597 回答