// ==========================================
// 🚀 站群智能电闸 (DEBUG 排查模式)
// ==========================================
$file_info_chk = datacaches . "info/" . $dirid . "/" . $aid . ".txt";
$file_index_chk = datacaches . "index/" . $dirid . "/" . $aid . ".txt";
// 1. 检查物理文件到底存不存在
$debug_msg = "";
if (!file_exists($file_info_chk)) {
$debug_msg .= "[Info缓存] 文件不存在,期望路径: {$file_info_chk}
";
}
if (!file_exists($file_index_chk)) {
$debug_msg .= "[Index缓存] 文件不存在,期望路径: {$file_index_chk}
";
}
if ($debug_msg != "") {
die("
🚨 步骤 1 失败:缓存文件丢失
" . $debug_msg);
}
// 2. 读取并反序列化数据
$book = unserialize(file_get_contents($file_info_chk));
$chapters = unserialize(file_get_contents($file_index_chk));
// 3. 检查数据是否损坏为空
if (empty($chapters)) {
die("🚨 步骤 2 失败:数据解析为空
Index缓存文件存在,但反序列化后数据为空!可能是文件被清空或格式不兼容。
读取路径: {$file_index_chk}");
}
// 4. 检查当前章节ID是否存在于缓存目录中
if (array_key_exists($chapterid, $chapters) == false) {
$keys = array_keys($chapters);
$first_key = reset($keys);
$last_key = end($keys);
$count = count($keys);
die("🚨 步骤 3 失败:找不到对应的章节 ID
缓存文件一切正常,但是里面没有当前请求的章节 ID: {$chapterid}
当前缓存文件共包含 {$count} 个章节,其 ID 范围大约是从 {$first_key} 到 {$last_key}。
排查建议:检查传递的章节ID对不对,或者缓存是不是没更新导致最新章没进去。");
}
$curchapter=$chapters[$chapterid];
// ==========================================