【发布时间】:2012-10-20 05:37:26
【问题描述】:
我想制作回复有限的评论系统。 例如:
#1st comment
## reply to the 1st comment
## reply to the 1st comment
#2nd comment
#3rd comment
## reply to the 3rd comment
因此,每条评论都有一个回复树。 最后我想这样使用它,假设我有来自 db 的 $cmets 对象数组:
foreach($comments as $comment)
{
echo $comment->text;
if($comment->childs)
{
foreach($comment->childs as $child)
{
echo $child->text;
}
}
}
所以我想我需要创建另一个对象,但不知道如何让它全部工作。我应该使用 stdClass 还是其他东西? 提前致谢。
【问题讨论】: