首页 > 解决方案 > Json output array to php variable

问题描述

prob an easy fix, but I'm stuck.

So print_r($data) =

stdClass Object (
    [code] => 200000
    [data] => stdClass Object (
        [accountEquity] => 111
        [unrealisedPNL] => 111
        [marginBalance] => 111
        [positionMargin] => 111
        [orderMargin] => 0
        [frozenFunds] => 0
        [availableBalance] => 111
        [currency] => xxx
    )
)

And echo $data->code outputs '20000'

But I can not get the other 'variables' to work. Ive tried:

$data->code->data->accountEquity

$data[1]->accountEquity

$data->code->data->accountEquity

What is the right format to get those other values?

Thank you. gr Mike

标签: phpjsonvariablesjsonencoder

解决方案


最好的获取方式accountEquity

$data->data->accountEquity

推荐阅读