第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

權(quán)限列表的循環(huán)

權(quán)限列表的循環(huán)

PHP
紅顏莎娜 2019-03-18 15:36:51
如題我有一個(gè)查詢會(huì)查出當(dāng)前用戶所有的權(quán)限 $authList = [ ['id' => 1, 'pid' => 0, 'title' => 'project'], ['id' => 2, 'pid' => 0, 'title' => 'customer'], ['id' => 3, 'pid' => 1, 'title' => 'select'], ['id' => 4, 'pid' => 1, 'title' => 'delete'], ['id' => 5, 'pid' => 2, 'title' => 'select'], ['id' => 6, 'pid' => 2, 'title' => 'delete'], ['id' => 7, 'pid' => 6, 'title' => 'logic delete'] ]; 我想重新組織這個(gè)數(shù)組使它根據(jù)pid變成樹(shù)形結(jié)構(gòu),就像這樣 $result = [ [ 'id' => 1, 'pid' => 0, 'title' => 'project', 'children' => [ [ 'id' => 3, 'pid' => 1, 'title' => 'select' ], [ 'id' => 4, 'pid' => 1, 'title' => 'delete' ], ] ], [ [ 'id' => 2, 'pid' => 0, 'title' => 'customer', 'children' => [ [ 'id' => 5, 'pid' => 2, 'title' => 'select' ], [ 'id' => 6, 'pid' => 2, 'title' => 'delete', 'children' => [ [ 'id' => 7, 'pid' => 6, 'title' => 'logic delete' ] ], ] ], ], ], ]; 請(qǐng)問(wèn)大家有沒(méi)有什么要率高的算法?
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 378 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)