树状结构

function array2tree($data, $pId)
{
    $tree = array();
    foreach($data as $k => $v) {
      if ($v['father_id'] == $pId) { 
           $v['child'] = array2tree($data, $v['organization_id']);
           $tree[] = $v;
      }
    }
    return $tree;
}
posted @ 2019-08-19 17:01  马户  阅读(122)  评论(0编辑  收藏  举报