重新编辑问题:
$ch= '
[{
"school": "A校",
"g": "一年级",
"c": "一班",
"n": [
"男#25",
"女#29"
]
},
{
"school": "A校",
"g": "一年级",
"c": "二班",
"n": [
"男#30",
"女#22"
]
}]
'
$chcd= json_decode($ch, true);
for($i=0;$i<count($chcd);$i++){
echo "".$chcd[$i]['type']."<br /><h1>".$chcd[$i]['school']." ".$chcd[$i]['c']." ".$chcd[$i]['yy']."</h1>";
echo $chcd->def[$i]->cx;
echo "<br /><br />";}
PHP循环输出:
<h1>学校</h1><h2>年级</h2><h3>班级</h3>
<div>
<ul>
<li><u>性别</u>:人数</li>
<li><u>性别</u>:人数</li>
<!--以上"li"循环输出-->
</ul>
</div>
不能循环输出“性别”和“人数”,请求指导!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…