PHP: Simple read data from part of a string?
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.
精彩评论