请教TP官网的评论功能如何实现

浏览:3015 发布日期:2014/07/09 分类:求助交流 关键字: TP 评论
我想做一个TP官网效果的评论,如图

我先建了一个评论表message,如图

做了一个自关联模型namespace Common\Model;
use Think\Model\RelationModel;
class MessageRelationModel extends RelationModel{
    protected $tableName='Message';
    protected $_link=array(

        'Parent' => array(
            'mapping_type' => self::BELONGS_TO,
            'class_name' => 'Message',
            'mapping_name' => 'Message',
            'parent_key' => 'pid',
            ),
        );    
}
可是实际使用中好像无法生成,官网所示的评论列表,请教各位大神,应该如何做?谢谢
附自关联结果array (size=4)
  0 => 
    array (size=7)
      'id' => string '5' (length=1)
      'time' => string '0' (length=1)
      'ip' => string '0.0.0.0' (length=7)
      'content' => string '评论1' (length=7)
      'article_id' => string '1' (length=1)
      'pid' => string '0' (length=1)
      'Message' => null
  1 => 
    array (size=7)
      'id' => string '6' (length=1)
      'time' => string '1' (length=1)
      'ip' => string '0.0.0.0' (length=7)
      'content' => string '评论2' (length=7)
      'article_id' => string '1' (length=1)
      'pid' => string '0' (length=1)
      'Message' => null
  2 => 
    array (size=7)
      'id' => string '7' (length=1)
      'time' => string '0' (length=1)
      'ip' => string '0.0.0.0' (length=7)
      'content' => string '评论1回复1' (length=14)
      'article_id' => string '1' (length=1)
      'pid' => string '5' (length=1)
      'Message' => null
  3 => 
    array (size=7)
      'id' => string '8' (length=1)
      'time' => string '0' (length=1)
      'ip' => string '0.0.0.0' (length=7)
      'content' => string '评论1回复1回复' (length=20)
      'article_id' => string '1' (length=1)
      'pid' => string '7' (length=1)
      'Message' => null
最佳答案
评论( 相关
后面还有条评论,点击查看>>