prepare("SELECT * FROM articles WHERE id = ?");
$stmt->execute([$article_id]);
$article = $stmt->fetch();
?>
">
{$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 "