1

我想从位置键中获取 ahmedab​​ad,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 ) )

我浏览了许多网站上的解决方案,但不知道如何做到这一点。请我感谢您的帮助。我希望我已经给出了重要的细节。

4

2 回答 2

3

循环元素:

foreach($jsonResponse['result'] as $val){
    echo $val['location'];
}
于 2012-10-04T10:15:37.893 回答
1
$jsonResponse['result'][0]['location'] // 'ahmedabad'
$jsonResponse['result'][1]['location'] // 'Surat'
于 2012-10-04T10:15:50.250 回答