私はこれを解決しようとしている 24 時間ハッカソンにいるので、少し急いでいる場合はすみません。
最初の 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 ?}>
次に、各ルックの 2 番目で、この URL からアイテムを取得します。
https://dev.xola.com/api/experiences
最後の URL のカテゴリに一致する
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++ {?> echo $v ?
foreach($json_b as $x){?>
if($v==$x):
echo $v
endif;
?>
}?>