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

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

WBOY
WBOYOriginal
2016-06-20 12:46:54884browse

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


无限递归函数--

/** * 无限递归 * @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;}



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


回复讨论(解决方案)

thinkPHP3.2递归

thinkPHP3.2递归

thinkPHP3.2递归

大大,这是什么意思
Statement:
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