prepare($sql); if (!$stmt) { die('预处理语句失败: ' . $conn->error); } $stmt->bind_param($paramTypes, ...$params); if (!$stmt->execute()) { die('执行语句失败: ' . $stmt->error); } $result = $stmt->get_result(); } else { $result = $conn->query($sql); if (!$result) { die('查询失败: ' . $conn->error); } } $tagResult = $conn->query("SELECT id, name FROM tags ORDER BY name"); ?>
...
prepare($tagSql); $tagStmt->bind_param('i', $row['id']); $tagStmt->execute(); $tagResult = $tagStmt->get_result(); $tags = []; while ($tag = $tagResult->fetch_assoc()) { $tags[] = htmlspecialchars($tag['name']); } $tagStmt->close(); // 获取应用适用平台 $platforms = json_decode($row['platforms'], true); echo ' 标签: '. implode(', ', $tags) . '未找到相关应用。