一種方法是使用 js,使用以下方法計(jì)算元素getElementsByClassName:var numberOfElements = document.getElementsByClassName('products').length;然后 :if (numberOfElements > 9) {document.getElementById('last-img').style.display = 'block';} else {document.getElementById('last-img').style.display = 'none';}
2 回答

慕尼黑8549860
TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超11個(gè)贊
foreach ($json as $key => $row) {
var_dump($row); //[ 'appid':10, ... ]
var_dump($row['name']); //counter-strike, ...
var_dump($key); //10, 20, 30, ...
}

神不在的星期二
TA貢獻(xiàn)1963條經(jīng)驗(yàn) 獲得超6個(gè)贊
試試這個(gè)
foreach ($json as $key => $value){
//$key = 220
//$value = the same as $json[$key]
$value['name'];
//THE SAME AS
$json[$key]['name'];
}
- 2 回答
- 0 關(guān)注
- 137 瀏覽
添加回答
舉報(bào)
0/150
提交
取消