标签:code div self 递归 return each php pre turn
public static function getNode($node_arr = [], $pid = 0) { $node_arr = empty($node_arr) ? self::getAll() : $node_arr; $node = []; $tem = []; foreach ($node_arr as $v) { if ($v[‘pid‘] == $pid) { $tem = self::getNode($node_arr, $v[‘id‘]); $tem && $v[‘child‘] = $tem; $node[] = $v; } } return $node; }
标签:code div self 递归 return each php pre turn
原文地址:http://www.cnblogs.com/betx/p/6907610.html