【发布时间】:2017-01-14 07:53:48
【问题描述】:
我的代码是:
$requesturl='https://blockchain.info/tx-index/1fda663d2584425f192eae045d3809950883ebe50f2222f98ef7d31f414f3f96?format=json';
$ch=curl_init($requesturl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$cexecute=curl_exec($ch);
curl_close($ch);
$result = json_decode($cexecute,true);
// to get the first i use
echo $result['out'][0]['addr'];
to get the second I use
echo $result['out'][0]['addr'];
现在我的要求是使用 for each 但它的抛出错误来查看数组:
foreach ($result['out'] as $adressee) {
echo $adressee.'<br>';
}
【问题讨论】:
-
这个问题的标题到底是什么意思?
-
@duskwuff 问题只是用户想要遍历 json 响应。该json数据是否为比特币交易信息无关紧要。
标签: php json foreach blockchain