【发布时间】:2021-10-03 22:22:58
【问题描述】:
可能很容易解决,但我被卡住了。
所以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
)
)
并且 echo $data->code 输出 '20000'
但我无法让其他“变量”工作。 我试过了:
$data->code->data->accountEquity
$data[1]->accountEquity
$data->code->data->accountEquity
获取其他值的正确格式是什么?
谢谢。克迈克
【问题讨论】:
-
尝试重构你的调试输出,你会很快看到解决方案(我已经编辑了你的问题)。否则,它很可能会帮助您为正在使用的任何 IDE 使用调试器。只需谷歌“使用 [your ide here] 调试 php”
-
欢迎来到 Stackoverflow。请阅读如何ask a good question 并提供minimal reproducible example 最好是Stack snippet
标签: php json variables jsonencoder