我想从位置键获取ahmedabad,surat。我正在给出一个输出
$jsonResponse = Zend_JSON::decode(substr($response['body'], 9));
print_r($jsonResponse['result']);
//output :Array ( [0] => Array ( [location] => ahmedabad [id] => 18x49 ) [1] => Array ( [location] => Surat [id] => 18x42 ) )
我在许多网站上浏览过这些解决方案,但却没有知道如何实现这一目标。请告诉我你的帮助。我希望我已经提供了必要的细节。
答案 0 :(得分:3)
循环元素:
foreach($jsonResponse['result'] as $val){
echo $val['location'];
}
答案 1 :(得分:1)
$jsonResponse['result'][0]['location'] // 'ahmedabad'
$jsonResponse['result'][1]['location'] // 'Surat'