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

时间:2012-06-04 12:37:54

标签: php stdclass

我在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);

如果可以,请帮助我。

1 个答案:

答案 0 :(得分:0)

你还没有提供$ obj实际上在这里的详细信息,但看起来好像问题只是你$ obj没有定义该属性。

相关问题