我试图使用PHP在嵌套的JSON中查找值。我已完成了print_r()
并得到:
Array
(
[types] => Array
(
[0] => Array
(
[name] => Running
[arabicName] => الجاري
[categories] => Array
(
[0] => Array
(
[name] => Entertainment
[arabicName] => تسلية
[programs] => Array
(
[0] => Array
(
[id] => 375
[name] => Saalo Marteh
[arabicName] =>
[image] => http://plus.mtv.com.lb/Chrome/KPanel/Pictures/Programs/151120100928327.jpg
)
[1] => Array
(
[id] => 491
[name] => Celebrity Duets
[arabicName] =>
[image] => http://plus.mtv.com.lb/Chrome/KPanel/Pictures/Programs/151108084429774.jpg
)
我试图在娱乐标题下获取name
和id
的值。
我尝试过以下但没有运气:
echo $json['types']['categories'][0]['name'];
答案 0 :(得分:0)
foreach ($json['types'][0]['categories'][0]['programs'] as $value) {
echo $value['id'] . ' ' . $value['name'];
}