<?php
require_once 'config.php';
// 测试获取一个详情
$id = $pdo->query("SELECT MIN(id) FROM custom_details")->fetchColumn();
echo "测试ID: $id\n";
$stmt = $pdo->prepare("SELECT cd.*, cc.name AS category_name FROM custom_details cd LEFT JOIN custom_categories cc ON cd.category_id = cc.id WHERE cd.id = ?");
$stmt->execute([$id]);
$d = $stmt->fetch(PDO::FETCH_ASSOC);
echo "标题: {$d['title']}\n";
echo "分类: {$d['category_name']}\n";
echo "内容前50字: " . mb_substr($d['content'], 0, 50) . "...\n";