php实现无限级嵌套评论回复代码
代码语言:php
所属分类:其他
代码描述:使用php的数组排序和递归实现无限级嵌套评论及回复代码。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<?php //模拟数据库取出的数组,评论时间字段省略 $data = array( array('id' => 1, 'pid' => 0, 'article_id' => 1, 'path' => '01,', 'author' => 'falcon', 'content' => '这是评论的内容,content #1 <a href="">雕刻时光</a>'), array('id' => 2, 'pid' => 0, 'article_id' => 1, 'path' => '02,', 'author' => 'chen', 'content' => 'content #2'), array('id' => 3, 'pid' => 1, 'article_id' => 1, 'path' => '01,03,', 'author' => 'xx', 'content' => 'content #3回复评论#1'), array('id' => 4, 'pid' => 0, 'article_id' => 1, 'path' => '04,', 'author' => 'falcon4', 'content' => 'content #4'), array('id' => 5, 'pid' => 3, 'article_id' => 1, 'path' => '01,03,05,', 'author' => 'falcon5', 'content' => 'content #5,回复评论#3.........完整代码请登录后点击上方下载按钮下载查看
网友评论0