2013-09-30 18 views
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 

回答

3

你正在考虑的对象数组。

这里是解决方案:

print $trxnResult->Bank_Resp_code;

+0

您应该删除尾随''' –

+0

我认为这必须是简单的东西....谢谢! 我删除了它... – user2087269