尝试从JSON收到的结果中打印记录。以下是JSON结果的格式
我进入$result = json_decode($result,true);
Array
(
[title] => API Directory
[description] => This directory contains links for Product Feed API and Delta Feed API of all categories with all the versions available
[apiGroups] => Array
(
[affiliate] => Array
(
[name] => affiliate
[apiListings] => Array
(
[food_nutrition] => Array
(
[availableVariants] => Array
(
[v0.1.0] => Array
(
[resourceName] => food_nutrition
[get] =>
[deltaGet] =>
[top] =>
[post] =>
[put] =>
[delete] =>
)
[v1.1.0] => Array
(
[resourceName] => food_nutrition
[get] =>
[deltaGet] =>
[top] =>
[post] =>
[put] =>
[delete] =>
)
)
[apiName] => food_nutrition
)
)
)
)
)
我想打印[resourceName]
和[get] from [v1.1.0] => Array
我怎么能这样做?请指教。
答案 0 :(得分:0)
echo $result['apiGroups']['affiliate']['apiListings']['food_nutrition']['availableVariants']['v1.1.0']['resourceName'];
echo $result['apiGroups']['affiliate']['apiListings']['food_nutrition']['availableVariants']['v1.1.0']['get'];
不是很漂亮,但无论如何,它毕竟是一个多维数组。