无限分类函数,你懂得 源数据格式:$arr = array(array(id=1, name=分类1, parentId=0),。。。); 无 function category($data, $parentId=0){$category = array();foreach ($data as $key=$value){if ($value['parentId'] == $parentId){unset($data[$key]);$
无限分类函数,你懂得
源数据格式:$arr = array(array('id'=>1, 'name'=>'分类1', 'parentId'=>0),。。。);
function category(&$data, $parentId=0) { $category = array(); foreach ($data as $key=>$value) { if ($value['parentId'] == $parentId) { unset($data[$key]); $value['child'] = category($data, $value['id']); $category[] = $value; } } return $category; }

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.