function comments() { if (IReq::get('id') === null) { IError::show(403, "传递的参数不完整"); } $id = intval(IReq::get('id')); if (!isset($this->user['user_id']) || $this->user['user_id'] === null) { IError::show(403, "登录后才允许评论"); } $can_submit = Comment_Class::can_comment($id, $this->user['user_id']); if ($can_submit[0] == -1) { IError::show(403, "没有这条数据"); } $this->can_submit = $can_submit[0] == 1; $this->comment = $can_submit[1]; $this->comment_info = Comment_Class::get_comment_info($this->comment['goods_id']); $this->redirect("comments"); }
function comments() { $id = IFilter::act(IReq::get('id'), 'int'); if (!$id) { IError::show(403, "传递的参数不完整"); } if (!isset($this->user['user_id']) || $this->user['user_id'] == null) { IError::show(403, "登录后才允许评论"); } $can_submit = Comment_Class::can_comment($id, $this->user['user_id']); if ($can_submit[0] == -1) { IError::show(403, "没有这条数据"); } $this->can_submit = $can_submit[0] == 1; //true值 $this->comment = $can_submit[1]; //评论数据 $this->comment_info = Comment_Class::get_comment_info($this->comment['goods_id']); $this->redirect("comments"); }