OK, acc = BURST-KHTJ-G3H7-LD2Q-H7LJ6 일 때 API 호출을합니다. 이것은 첫 번째 배열은지구상에서 PHP 코드가 잘못된 이유는 무엇입니까?
내 코드는 다음과
처럼 보이는}json_decode(file_get_contents("http://127.0.0.1:8125/burst?requestType=getAsset&asset=".assetBalance))
{
"decimals": 1,
"numberOfTrades": 58,
"asset": "15295227971848272658",
"quantityQNT": "1000000",
"description": "Shares in BURST pool. See https://burstforum.com/index.php?threads/the-big-announcement.149/ for more details",
"name": "HardInvest",
"accountRS": "BURST-T7BK-USTG-KVKC-D2RDL",
"account": "13343849956527346993"
에서 다음 json_decode(file_get_contents("http://127.0.0.1:8125/burst?requestType=getAccount&account=".$_GET['acc']))
{
"publicKey": "231add65e7233e8df06debe3e71f161cb8975d21c9f9ee6e52f4868f524cb64d",
"assetBalances": [
{
"asset": "15295227971848272658",
"balanceQNT": "4205"
},
{
"asset": "11375670541237055652",
"balanceQNT": "15"
}
],
"guaranteedBalanceNQT": "0",
"balanceNQT": "5465615075791",
"name": "Irontiga",
"accountRS": "BURST-KHTJ-G3H7-LD2Q-H7LJ6",
"unconfirmedAssetBalances": [
{
"unconfirmedBalanceQNT": "4205",
"asset": "15295227971848272658"
},
{
"unconfirmedBalanceQNT": "15",
"asset": "11375670541237055652"
}
],
"account": "17456591454562991920",
"effectiveBalanceNXT": 0,
"unconfirmedBalanceNQT": "4870615075791",
"forgedBalanceNQT": "0"
}
하고 배열에서 오는
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
$account = json_decode(file_get_contents("http://127.0.0.1:8125/burst?requestType=getAccount&account=".$_GET['acc']));
foreach($account->assetBalances as $assetBalance)
{
$assetInfo = json_decode(file_get_contents("http://127.0.0.1:8125/burst?requestType=getAsset&asset=".$assetBalance));
echo $assetInfo['name'];
echo "<br>"
}
?>
</body>
</html>
하지만 작동하지 않는 이유는 무엇입니까? $assetBalance
에 assetBalance
를 대체 할
"작동하지 않습니다"... 정확히 ** 작동하지 않는 ** 것을 설명 할 수 있습니까? – Azrael
페이지를로드 할 때 아무것도 나타나지 않습니다. 그냥 평범하지 않습니다 – Irontiga
당신은 아마 우리에게 PHP 오류를 보여주는 도움이되어야합니다. PHP 오류가 표시되지 않으면 다음 코드를 사용하여 오류를 표시하십시오.' php ini_set ('display_errors', 'On'); error_reporting (E_ALL); ?>' 또 다른 손으로는, 당신의 코드에 오타가 있습니다. 'assetBalance'는'$ assetBalance'이어야합니다. 그것은 변수입니다. –