json_解码不打印对象价格_美元

json_解码不打印对象价格_美元,json,decode,Json,Decode,费率:1 BCH/比特币现金=美元如果您使用var\u dump($array)您可以看到它的确切结构。你目前试图得到它的方式没有多大意义 API中的JSON如下所示: [ { "id": "bitcoin-cash", "name": "Bitcoin Cash", "symbol": "BCH", "rank": "3", "price_usd": "3205.57", "pri


费率:1 BCH/比特币现金=美元
如果您使用var\u dump($array)您可以看到它的确切结构。你目前试图得到它的方式没有多大意义

API中的JSON如下所示:

[
    {
        "id": "bitcoin-cash", 
        "name": "Bitcoin Cash", 
        "symbol": "BCH", 
        "rank": "3", 
        "price_usd": "3205.57", 
        "price_btc": "0.208515", 
        "24h_volume_usd": "4509330000.0", 
        "market_cap_usd": "54073197615.0", 
        "available_supply": "16868513.0", 
        "total_supply": "16868513.0", 
        "max_supply": "21000000.0", 
        "percent_change_1h": "-0.83", 
        "percent_change_24h": "-17.54", 
        "percent_change_7d": "71.22", 
        "last_updated": "1513885472"
    }
]
…在将其转换为assoc数组后(通过将
true
传递到
json_decode()
作为其第二个参数,获取速率应按如下方式进行:


$array[0]['price_usd']

你能完成代码吗?它打印给我的是array而不是对象price上帝保佑你,我固定了它$rate=$array[0]['price_usd'];可能是