开发者

Dealing with hash in PHP json object

I have a json object that follows the following structure:

$foo->bar['1']->#foobar

The hash is causing it to fail, how do I ge开发者_如何学Pythont the value of #foobar?

Thanks


Try the curly brace syntax:

$foo->bar['1']->{'#foobar'}


When you use PHP's json_decode, pass true as the second variable, that will return an associative array, those are easier to deal with in such cases.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜