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

WBOY
Release: 2016-06-13 12:25:43
Original
897 people have browsed it

关于thinkPHP3.2的无限遍历问题,困扰了几天了
先贴图和代码------------


无限递归函数--

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



要的是无限循环,o(>﹏------解决思路----------------------
thinkPHP3.2递归

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!