Home > Backend Development > PHP Tutorial > 关于thinkPHP3.2的无限遍历问题,困扰了几天了

关于thinkPHP3.2的无限遍历问题,困扰了几天了

WBOY
Release: 2016-06-20 12:46:54
Original
883 people have browsed it

先贴图和代码------------


无限递归函数--

/** * 无限递归 * @param $data * @param $pId * @return array * @author 郑景强 */function getTree($data, $pId = 0){    $tree = array();    foreach($data as $k => $v){        if($v['pid'] == $pId){            //父亲找到儿子            $v['children'] = getTree($data, $v['id']);            $tree[] = $v;            //unset($data[$k]);        }    }    return $tree;}
Copy after login



要的是无限循环,o(>?


回复讨论(解决方案)

thinkPHP3.2递归

thinkPHP3.2递归

thinkPHP3.2递归

大大,这是什么意思
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template