编码/从数组中获取单个结果

时间:2017-04-03 06:02:51

标签: php json var

所以我有这个数组

object(stdClass)#19 (2) { ["status"]=> string(7) "success" ["data"]=> object(stdClass)#14 (6) { ["network"]=> string(3) "BTC" ["txid"]=> string(64) "128830010b4773bb9a88f9c53b67217f37caa092bfd477a81a2f41d6ea804e53" ["amount_withdrawn"]=> string(10) "0.00087298" ["amount_sent"]=> string(10) "0.00050000" ["network_fee"]=> string(10) "0.00037298" ["blockio_fee"]=> string(10) "0.00000000" } }

但我不知道如何获取txid这样的单一数据,我不确定它是json还是..

1 个答案:

答案 0 :(得分:0)

这是如何:

  $myarray = (array) $my_var ; // what u have is a class and not an array, just cast it

 echo $myarray["data"]["txid"];