我正在尝试从数组
下面获取merchantAccountId值Array
(
[status] => 1
[result] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => Braintree_Result_Successful
[success] => 1
[_returnObjectName:Braintree_Result_Successful:private] => transaction
[transaction] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => Braintree_Transaction
[_attributes] => Array
(
[id] => 6vk28p
[status] => submitted_for_settlement
[type] => sale
[currencyIsoCode] => USD
[amount] => 800.00
[merchantAccountId] => contentorganisation
[orderId] =>
[createdAt] => DateTime Object
(
[date] => 2015-07-24 11:51:42
[timezone_type] => 3
[timezone] => UTC
)
)
)
)
)
我的代码是$ result ['结果'] ['交易']。 当我打印这个我有这个错误
Fatal error: Cannot use object of type __PHP_Incomplete_Class as array in.
答案 0 :(得分:0)
结果是OBJECT而不是数组,所以你必须通过以下方式调用它:
Array['result']->transaction->_attributes['id']
答案 1 :(得分:0)
我在Braintree工作。您应该可以通过致电$result->transaction->merchantAccountId
来访问商家帐户ID,(请参阅Braintree docs)。