为何TP5.1 select出来的值只有一组?

浏览:497 发布日期:2018/08/12 分类:ThinkPHP5专区 关键字: TP5.1 select
为何TP5.1 select出来的值只有一组?
数据库中有6条测试数据。if($count > 0 ) {
            $res = Db::name('left_menu')->where('pid',0)->select();
            $data="";
            foreach($res as $key => $val){
                          //2级
                    $res2 = Db::name('left_menu')->where('pid',$val['id'])->order('id', 'asc')->select();
                    $data2="";
                    foreach($res2 as $k2 => $v2){
                                      //3级
                                $res3 = Db::name('left_menu')->where('pid',$v2['id'])->order('id', 'asc')->select();
                                $data3="";
                                foreach($res3 as $k3 => $v3){
                                  // $data3[$k3]['title']=$v3['title'];
                                  // $data3[$k3]['name']=$v3['name'];
                                  // $data3[$k3]['icon']=$v3['icon'];
                                  // $data3[$k3]['jump']=$v3['jump'];
                                  // $data3[$k3]['title']=$v3['title'];
                                  // $data3[$k3]['status']=$v3['status'];
                                  // $data3[$k3]['rule']=$v3['rule'];
                                  // $data3[$k3]['param']=$v3['param'];     
                                  // dump($res3);die;
                                }
                      // $data2[$k]['title']=$v2['title'];
                      // $data2[$k]['name']=$v2['name'];
                      // $data2[$k]['spread']= true;
                      // $data2[$k]['icon']=$v2['icon'];
                      // $data2[$k]['jump']=$v2['jump'];
                      // $data2[$k]['status']=$v2['status'];
                      // $data2[$k]['rule']=$v2['rule'];
                      // $data2[$k]['param']=$v2['param'];
                      // $data2[$k]['list']=$data3;   
                      // dump($res2);die;           
                    }
              $data['name']=$val['name'];
              $data['title']=$val['title'];
              $data['icon']=$val['icon'];
              $data['jump']=$val['jump'];
              $data['spread']= true;
              $data['status']=$val['status'];
              $data['rule']=$val['rule'];
              $data['param']=$val['param'];
              $data['list']=$data2;
              dump($count);dump($val);dump($key);die;
            }
最佳答案
评论( 相关
后面还有条评论,点击查看>>