thinkphp三层嵌套符值问题
我想输出一个三层嵌套,可符值不知道出了什么错误、、$list1=$m1->where($where)->select();foreach($listas$n=>$val)...
我想输出一个三层嵌套,可符值不知道出了什么错误、、
$list1= $m1->where($where)->select();
foreach ($list as $n => $val) {
$list[$n]['voo']=$m2->select();
foreach ( $list[$n]['voo'] as $key => $value2) {
$list[$n]['voo']['vooo']=$m3->select();
}
} 展开
$list1= $m1->where($where)->select();
foreach ($list as $n => $val) {
$list[$n]['voo']=$m2->select();
foreach ( $list[$n]['voo'] as $key => $value2) {
$list[$n]['voo']['vooo']=$m3->select();
}
} 展开
1个回答
展开全部
$list1= $m1->where($where)->select();
foreach ($list as $n => $val) {
$list[$n]['voo'][]=$m2->select();
foreach ( $list[$n]['voo'] as $key => $value2) {
$list[$n]['voo'][$key]['vooo'][]=$m3->select();
}
}
追问
$list[$n]['voo'][$key]['vooo'][]=$m3->select(); 这句话有错误哈?
主要是指[]
追答
没有错呢
$arr[] 是往数组里加元素
$arr = array("0"=>"Dog","1"=>"Cat","2"=>"Horse");
$arr[] = 'Book';
最终就是:
array("0"=>"Dog","1"=>"Cat","2"=>"Horse","3"=>"Book");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询