2017-01-14 1 views
-1

내 코드는 방법 :비트 코인 거래 데이터의 JSON 배열을 통해 루프

$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']; 

이제 내 요구 사항이 각각 사용하여 배열을 통해 보는 것입니다하지만 던지는 오류 :

foreach ($result['out'] as $adressee) { 
    echo $adressee.'<br>'; 
} 
+0

이 질문의 제목은 무엇을 의미합니까? – duskwuff

+0

@duskwuff 질문은 단순히 json 응답을 반복하려는 사용자입니다. 해당 json 데이터가 비트 동전 트랜잭션 정보인지 여부는 관련성이 없습니다. – Kang

답변

0
for($i=0; $i<count($result['out']); $i++) { 

    echo $result['out'][$i]["addr"].'<br>'; 
    } 

PHP 매뉴얼의 일부 샘플 코드가이 솔루션을 제안하는 데 도움이되었습니다.