Home >
Backend Development >
PHP Tutorial >
PHP unlimited classification can support the output of tree diagram implementation code_PHP tutorial
PHP unlimited classification can support the output of tree diagram implementation code_PHP tutorial
WBOY
Release: 2016-07-13 16:56:15
Original
851 people have browsed it
This is a piece of PHP unlimited classification implementation code that can support the output of tree diagrams. Friends who need to know more about it can refer to it from other websites. For the database structure, we only need the three fields of id, parentid, and name. Everyone You can create it yourself.
We only need the database structure
No platform restrictions
Just tell the id, parentid, name
The following is the php code, which requires php environment support
The code is as follows
Copy code
/**
* Universal tree class, can generate any tree structure */
class tree
{
/**
* The 2-dimensional array required to generate a tree structure
* @var array
*/
var $arr = array();
/**
* The modification symbols required to generate a tree structure can be replaced by pictures
* @var array
*/
var $icon = array('│','├','└');
function have($list,$item){
return(strpos(',,'.$list.',',','.$item.','));
}
}
?>
效果就是
代码如下
代码如下
复制代码
aa
bbb
ccc
复制代码
aa
bbb
ccc
这样哦,可实现无限级分类哦,
http://www.bkjia.com/PHPjc/631610.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631610.htmlTechArticleThis is a PHP unlimited classification implementation code that can support the output of tree diagrams. It is transferred from other websites for those who need to know more. You can refer to it. For the database structure, we only need these three items: id, parentid, and name...
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