0

我在 class_post.php 中编写以下代码:

$this->post_message = stripslashes($obj->message);
$this->post_date        = intval($obj->date);
$this->comments_disabled = intval($obj->dis_comment);
$this->post_mentioned   = array();
$this->post_attached    = array();
$this->post_posttags    = array();
$this->post_comments    = array();
$this->post_commentsnum = 0;
$this->post_commentsnum = 0;

和 class_post.php 中的这个函数:

  public function disable_comment($num)
    {

        if( $this->error ) {
            return FALSE;
        }
        if( $this->is_system_post ) {
            return FALSE;
        }

        if( ! $this->user->is_logged ) {
            return FALSE;
        }
                    if( $this->user->id != $this->post_user->id && $this->user->info->is_network_admin != 1) {
            return FALSE;
        }
                    $n = intval($num);
        $this->db2->query('UPDATE posts SET dis_comment="'.$n.'" WHERE id="'.$this->post_id.'" LIMIT 1');

        return TRUE;
    }

当我进入评论页面时,我看到了这个错误:

注意:未定义的属性:第 154 行 \classes\class_post.php 中的 stdClass::$dis_comment

154 = $this->comments_disabled = intval($obj->dis_comment);

如果可以,请你帮助我。

4

1 回答 1

0

您还没有提供 $obj 实际在此处的详细信息,但看起来问题只是您 $obj 没有定义该属性。

于 2012-06-04T12:54:30.553 回答