This article mainly introduces how php can be applied to the recursive searching of tree trees in the breadcrumb navigation. It involves the array recursive operation technique and is of great practical value. For more information, see
This article mainly introduces how php can be applied to the recursive searching of tree trees in the breadcrumb navigation. It involves the array recursive operation technique and is of great practical value. For more information, see
The example in this article describes how php can be used to Recursively search for the Genealogy Tree in the breadcrumb navigation. Share it with you for your reference. The specific implementation method is as follows:
<? Phpecho"
"; $ Area = array ('id' => 1, 'region' => 'beijing', 'pid '=> 0 ), array ('id' => 2, 'area '=> 'guangxi', 'pid '=> 0), array ('id' => 3, 'area '=> 'guangdong', 'pid '=> 0), array ('id' => 4, 'area' => 'fujian ', 'pid '=> 0), array ('id' => 11, 'area' => 'chaoyang district ', 'pid' => 1 ), array ('id' => 12, 'area '=> 'haidian district', 'pid '=> 1), array ('id' => 21, 'area '=> 'nanning City', 'pid '=> 2), array ('id' => 45, 'area' => 'fuzhou City ', 'pid '=> 4), array ('id' => 113, 'area' => 'Asian games cune', 'pid '=> 11 ), array ('id' => 115, 'area '=> 'Olympic village', 'pid '=> 11) , Array ('id' => 234, 'area '=> 'wuming County', 'pid '=> 21); function familytree ($ arr, $ id) {static $ list = array (); foreach ($ arr as $ v) {if ($ v ['id'] =id id) {familytree ($ arr, $ v ['pid ']); $ list [] = $ v ;}return $ list;} print_r (familytree ($ list, 113);?>I hope this article will help you with php programming.
,