-1
我使用bit coin API生成比特幣地址。位硬幣API的變量返回完整數組,我如何獲得只有「available_balance」部分。 只有這一部分:如何在PHP中獲取數組的特定區域對象?
[available_balance] => 0.00138592
代碼是:
$data=$block_io->get_address_balance(array('type' => 'received', 'addresses' => '3KHBGTRGFEgRHub8z5VUyT9L5ZUASpWZ'));
function pr($data)
{
echo "<pre>";
print_r($data); // or var_dump($data);
echo "</pre>";
}
pr($data);
輸出是:
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[network] => BTC
[available_balance] => 0.00138592
[pending_received_balance] => 0.00000000
[balances] => Array
(
[0] => stdClass Object
(
[user_id] => 5
[label] => Lalaa
[address] => 3KHBGTRGFEgRHub8z5VUyT9L5ZUASpWZ
[available_balance] => 0.00138592
[pending_received_balance] => 0.00000000
)
)
)
)