将JSON字符串转换为数组

Sir*_*r D 1 php arrays json function

我有这个JSON字符串

{"ticker":{"high":736.45099,"low":681,"avg":708.725495,"vol":13038780.63684,"vol_cur":18382.55965,"last":726,"buy":726,"sell":724.5,"updated":1388242741,"server_time":1388242743}}
Run Code Online (Sandbox Code Playgroud)

在做完之后如何获得" 最后 "参数json_decode()

Sha*_*ran 6

这样做

<?php
$json='{"ticker":{"high":736.45099,"low":681,"avg":708.725495,"vol":13038780.63684,"vol_cur":18382.55965,"last":726,"buy":726,"sell":724.5,"updated":1388242741,"server_time":1388242743}}';
$json_arr=json_decode($json,true);
echo $json_arr['ticker']['server_time'];//"prints" 1388242743 which is the last param "server time"
Run Code Online (Sandbox Code Playgroud)

  • 我也以类似的方式思考,因此[我的评论](http://stackoverflow.com/questions/20816105/convert-json-string-to-array#comment31212710_20816105).+1无论如何.:) (2认同)