<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ### 一、排序 1.表單 `<input type="text" name="{$v.id}" value="{$v.sort}" />` 利用id和值進行更新 2.數據處理 ~~~ foreach ($_POST as $id=>$sort){ $db->where(array('id'=>$id))->setField('sort',$sort); } ~~~ ### 二、按類遞歸 1. 靜態類 ~~~ class.Category.php <?php class Category{ //組合成一維數組 static public function unlimitedForLevel($cate, $html='--', $pid=0, $level=0){ $arr=array(); foreach($cate as $v){ if($v['pid']==$pid){ $v['level']=$level++; $v['html']=str_repeat($html,$level); $arr[]=$v; $arr=array_merge($arr,self::unlimitedForLevel($cate, $htmml, $v['id'], $level+1)); } } return $arr; } //組合成多維數組 static public function unlimitedForLayer($cate,$name='child',$pid=0){ $arr=array(); foreach($cate as $v){ if($v['pid']==$pid){ $v[$name]=self::unlimitedForLayer($cate,$name,$v['id']); $arr[]=$v; } } return $arr; } //返回所有父集數組 static public function getParents($cate,$id){ $arr=array(); foreach($cate as $v){ if($v['id']==$id){ $arr[]=$v; $arr=array_merge(self::getParents($cate,$v['pid']),$arr); } } return $arr; } //返回所有子集id數組 static public function getChildsId($cate, $pid){ $arr=array(); foreach ($cate as $v){ if($v['pid']==$pid){ $arr[]=$v['id']; $arr=array_merge($arr,self::getChildsId($cate,$v['id']); } } return $arr; } //傳遞一個父集分類ID返回所有子級分類數組 static public function getChildsId($cate, $pid){ $arr=array(); foreach ($cate as $v){ if($v['pid']==$pid){ $arr[]=$v; $arr=array_merge($arr,self::getChildsId($cate,$v['id']); } } return $arr; } } ?> ~~~ 2.靜態調用 ~~~ import('Class.Category',APP_PATH); $cate=M('cate')->orde('sort asc')->select(); $this->cate=Category::unlimiteForLevel($cate); $this->display(); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看