我建立一个PHP网站,需要一些由blockchain API(https://github.com/blockchain/api-v1-client-php)打印比特币地址交易中使用blockchain API
我想打印出来做的所有交易概述提供的功能具体的地址,但迄今为止没有成功。
我已经收集了地址的信息,但交易存储在一个数组中(如在文档中所写),并且无法将它们取出。
$limit = 50;
$offset = 0;
$address = "xxx";
$address_info = $Blockchain->Explorer->getAddress($address, $limit, $offset);
echo $address_info->n_tx; //just as a test, this works
$transactions = $address_info->transactions; //no error here
echo $transactions->version;
代码的最后一行引发此错误:“尝试获取非对象的属性”。 echo $ transactions [0]也不起作用。
github页面没有任何打印事务的例子。
的$的交易功能的var_dump这产生:
array (size=2)
0 =>
object(Blockchain\Explorer\Transaction)[11]
public 'double_spend' => boolean false
public 'block_height' => int 382334
public 'time' => int 1446833376
public 'lock_time' => int 0
public 'relayed_by' => string '192.99.2.32' (length=11)
public 'hash' => string 'd9f625afe46ea8bbe9dc74484cefbcb15fbd6887a1bc619b44161114b78ab038' (length=64)
public 'tx_index' => int 109866616
public 'version' => int 1
public 'size' => int 374
public 'inputs' =>
array (size=2)
0 =>
object(Blockchain\Explorer\Input)[12]
...
1 =>
object(Blockchain\Explorer\Input)[13]
...
public 'outputs' =>
array (size=2)
0 =>
object(Blockchain\Explorer\Output)[14]
...
1 =>
object(Blockchain\Explorer\Output)[15]
...
任何想法?
尝试'var_dump($ transactions)'或'print_r($ transactions)'查看它包含的内容 – RamRaider
Thanks !,我已经尝试过,这会打印整个数组,但是我想处理数组内容在单独的变量中。 所述的var_dump结果在此: '阵列(大小= 2) 0 => 对象(Blockchain \ Explorer中\ Transaction)的[11] 公共 'double_spend'=>布尔假 公共 'block_height'=> INT 382334 公共 '时间'=> INT 1446833376 公共 'lock_time'=> INT 0 公共 'relayed_by'=>字符串 '192.99.2.32'(长度= 11) ...' – frdho