Php simply implements an infinite classification tree list, which is a php classification tree list. Php simple implementation of the infinite classification tree list method, php classification tree list this article describes the php simple implementation of the infinite classification tree list method. Share it with you for your reference. Php simple implementation of the infinite classification tree list method, php Classification Tree list
The example in this article describes how php simply implements an infinite classification tree list. Share it with you for your reference. The details are as follows:
$ Items = array (1 => array ('id' => 1, 'pid '=> 0, 'name' => 'jiangxi '), 2 => array ('id' => 2, 'pid '=> 0, 'name' => 'heilongjiang province '), 3 => array ('id' => 3, 'pid '=> 1, 'name' => 'nanchang city '), 4 => array ('id' => 4, 'pid '=> 2, 'name' => 'Harbin '), 5 => array ('id' => 5, 'pid '=> 2, 'name' => 'jixi city '), 6 => array ('id' => 6, 'pid '=> 4, 'name' => 'xiangfang region '), 7 => array ('id' => 7, 'pid '=> 4, 'name' => 'nangang '), 8 => array ('id' => 8, 'pid '=> 6, 'name' =>' and Xinglu '), 9 => array ('id' => 9, 'pid '=> 7, 'name' => 'westbrook street '), 10 => array ('id' => 10, 'pid '=> 8, 'name' => 'Northeast forestry Emy '), 11 => array ('id' => 11, 'pid '=> 9, 'name' => 'Harbin Institute of Technology '), 12 => array ('id' => 12, 'pid '=> 8, 'name' => 'Harbin Normal University '), 13 => array ('id' => 13, 'pid '=> 1, 'name' => 'ganzhou city '), 14 => array ('id' => 14, 'pid '=> 13, 'name' => 'ganxian '), 15 => array ('id' => 15, 'pid '=> 13, 'name' => 'yudu County '), 16 => array ('id' => 16, 'pid '=> 14, 'name' => 'moudian Zhen '), 17 => array ('id' => 17, 'pid' => 14, 'name' => 'tagname '), 18 => array ('id' => 18, 'pid '=> 16, 'name' => 'yiyuan cune '), 19 => array ('id' => 19, 'pid '=> 16, 'name' => 'shangba cune '), 20 => array ('id' => 20, 'pid '=> 0, 'name' => 'Guangdong province '), 21 => array ('id' => 21, 'pid '=> 20, 'name' => 'Guangzhou'),); $ t = array (); foreach ($ items as $ id => $ item) {if ($ item ['pid ']) {$ items [$ item ['pid '] [$ item ['id'] = & $ items [$ item ['id']; $ t [] = $ id ;}} foreach ($ t as $ u) {unset ($ items [$ u]);} echo""; print_r($items);
I hope this article will help you with php programming.
Examples in this article describe how php simply implements an infinite classification tree list. Share it with you for your reference. Details...