时间:2021-07-01 10:21:17 帮助过:14人阅读
Array( [0] => Array ( [pid] => 0 [title] => 首页 [path] => index [current] => 0 [link] => /index.php ) [1] => Array ( [tid] => 3 [pid] => 8 [mid] => 8 [topid] => 0 [upid] => 0 [exmid] => 0 [linkid] => 2 [gotoid] => 17 [lng] => cn [larray] => Array ( [0] => Array ( [tid] => 17 [pid] => 50 [mid] => 8 [topid] => 3 [upid] => 3 ) [1] => Array ( [tid] => 18 [pid] => 50 [mid] => 8 [topid] => 3 [upid] => 3 ) [2] => Array ( [tid] => 19 [pid] => 50 [mid] => 8 [topid] => 3 [upid] => 3 ) ) ) [2] => Array ( [tid] => 5 [pid] => 2 [mid] => 3 [topid] => 0 [upid] => 0 [exmid] => 0 [larray] => Array ( [0] => Array ( [tid] => 11 [pid] => 50 [mid] => 3 [topid] => 5 [upid] => 5 ) [1] => Array ( [tid] => 12 [pid] => 50 [mid] => 3 [topid] => 5 [upid] => 5 ) [2] => Array ( [tid] => 22 [pid] => 50 [mid] => 8 [topid] => 5 [upid] => 5 ) ) ) [3] => Array ( [tid] => 50 [pid] => 4 [mid] => 8 [topid] => 0 [upid] => 0 [larray] => ) )
Array( [0] => Array ( [pid] => 0 [title] => 首页 [path] => index [current] => 0 [link] => /index.php ) [1] => Array ( [tid] => 5 [pid] => 2 [mid] => 3 [topid] => 0 [upid] => 0 [exmid] => 0 [larray] => Array ( [0] => Array ( [tid] => 11 [pid] => 50 [mid] => 3 [topid] => 5 [upid] => 5 ) [1] => Array ( [tid] => 12 [pid] => 50 [mid] => 3 [topid] => 5 [upid] => 5 ) [2] => Array ( [tid] => 22 [pid] => 50 [mid] => 8 [topid] => 5 [upid] => 5 ) ) ) [2] => Array ( [tid] => 50 [pid] => 4 [mid] => 8 [topid] => 0 [upid] => 0 [larray] => ) [3] => Array ( [tid] => 3 [pid] => 8 [mid] => 8 [topid] => 0 [upid] => 0 [exmid] => 0 [linkid] => 2 [gotoid] => 17 [lng] => cn [larray] => Array ( [0] => Array ( [tid] => 17 [pid] => 50 [mid] => 8 [topid] => 3 [upid] => 3 ) [1] => Array ( [tid] => 18 [pid] => 50 [mid] => 8 [topid] => 3 [upid] => 3 ) [2] => Array ( [tid] => 19 [pid] => 50 [mid] => 8 [topid] => 3 [upid] => 3 ) ) ) )
建议贴出 var_export();后的数组以便测试
等高手,我只会选择排序
设原数组为 $ar,则有
array_multisort(array_map(function($item){ return $item['pid']; }, $ar), $ar);
建议贴出 var_export();后的数组以便测试
这个就是 print_r 打印出来的
建议贴出 var_export();后的数组以便测试