开发者

PHP: Simple read data from part of a string?

开发者 https://www.devze.com 2023-02-28 06:12 出处:网络
From this string {\"ticker\":{\"hi开发者_StackOverflow中文版gh\":1.747,\"low\":1.6,\"vol\":13755,\"buy\":1.608,\"sell\":1.68,\"last\":1.61}}

From this string

{"ticker":{"hi开发者_StackOverflow中文版gh":1.747,"low":1.6,"vol":13755,"buy":1.608,"sell":1.68,"last":1.61}}

I need to get the "last" data (currently 1.61) I know there's an easy answer, but I'm not sure exactly what it is.


$values = json_decode($string, true);
echo $values['ticker']['last'];

See http://en.wikipedia.org/wiki/Json, http://php.net/json_decode.

0

精彩评论

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

关注公众号