prepare("SELECT * FROM articles WHERE id = ?"); $stmt->execute([$article_id]); $article = $stmt->fetch(); ?> "> <?php echo "{$article['title']} - 油田二中黑子站"; ?>
{$article['title']}"; echo "
发布于: {$article['created_at']}
"; echo "
分类: {$article_type[$article['type']]}
"; echo "

{$article['content']}

"; ?>

评论区

prepare("SELECT comments.content, users.username FROM comments JOIN users ON comments.user_id = users.id WHERE article_id = ? ORDER BY comments.created_at DESC"); $commentStmt->execute([$article_id]); while ($comment = $commentStmt->fetch()) { echo "
{$comment['username']}: {$comment['content']}
"; } ?>

登录后发表评论。