Home> php教程> php手册> body text

PHP实现无级递归分类(ThinkPHP框架),无级thinkphp

WBOY
Release: 2016-06-13 08:57:00
Original
1261 people have browsed it

PHP实现无级递归分类(ThinkPHP框架),无级thinkphp

/** * 无级递归分类 * @param int $assortPid 要查询分类的父级id * @param mixed $tag 上下级分类之间的分隔符 * @return string $tree 返回的分类树型结构结果 * */ function recursiveAssort($assortPid, $tag = '') { $assort = M('goods_class')->where("class_pid = $assortPid")->field('class_id, class_name')->select(); foreach ($assort as $value) { $tree .= ''; $tree .= recursiveAssort($value['class_id'], $tag . ' '); } return $tree; }
Copy after login

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 Recommendations
    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!