我在24小时的黑客马拉松试图解决这个问题,所以请原谅它是否有点匆忙。在另一个foreach json循环中循环一次foreach json循环
1 for each循环工作得很好,我是从这个URL获得类别列表
https://dev.xola.com/api/categories
我抓住这个
$fullurl = "https://dev.xola.com/api/categories";
$string .= file_get_contents($fullurl); // get json content
$json_a = json_decode($string, true); //json decoder
然后用这个
循环播放列表<?
foreach($json_a as $v)
{?>
echo $v ?}>
现在,每个外观的第二个,我想抓取这个URL的项目
https://dev.xola.com/api/experiences
从最后浏览的网址
so samething
$fullurl = "https://dev.xola.com/api/categories";
$string .= file_get_contents($fullurl); // get json content
$json_b = json_decode($string, true); //json decoder
这里匹配的类别,
是完整的循环我试着
<?
$i=0;
foreach($json_a as $v)
$ I ++ {?> 回声$ V?
foreach($json_b as $x){?>
if($v==$x):
echo $v
endif;
?>
}?>
有一些错字错误,请首先纠正他们 –
'$ 1 = 0;'? PHP变量不能以数字开头。 –
固定问题... – user2320607