public function deleteArticle() { $errors = $this->errors; //实例化Model $articleModel = new ArticleModel(); $commentModel = new CommentModel(); $collectModel = new CollectModel(); $articleTagModel = new ArticleTagModel(); $articleId = $_GET['articleId']; $articles = $articleModel->getArticleById($articleId); $tagIds = trim($articles['tagId'], ','); $articleTagModel->cutIncByTagIds($tagIds); $row = $articleModel->deleteArticle($articleId); //删除文章 $rows = $commentModel->delCommentByArticleId($articleId); //删除文章评论 $collectModel->deleteCollectByArticleId($articleId); if ($row) { $result['code'] = '0'; $result['message'] = $errors['0']; } else { $result['code'] = '036'; $result['message'] = $errors['036']; } echo json_encode($result); exit; }