chore(debug): 探针追加 route.php 内容与 OPcache 取证

这个提交包含在:
linda
2026-10-15 14:42:40 +08:00
父节点 8d94314fec
当前提交 d29ff8597f

查看文件

@@ -47,6 +47,35 @@ class Probe extends \app\common\controller\Api
'star_has_static' => isset($starBucket['api/v1/home/banners']),
];
// —— 追加:文件真实内容 & OPcache 取证 ——
$rf = CONF_PATH . 'route.php';
$out['route_file_realpath'] = is_file($rf) ? realpath($rf) : null;
$out['route_file_size'] = is_file($rf) ? filesize($rf) : -1;
$out['route_file_mtime'] = is_file($rf) ? date('c', filemtime($rf)) : null;
$loaded = is_file($rf) ? include $rf : null;
$out['included_is_array'] = is_array($loaded);
$out['included_rule_count'] = is_array($loaded) ? count($loaded) : -1;
$out['included_keys'] = is_array($loaded) ? array_slice(array_keys($loaded), 0, 4) : null;
$out['opcache_enabled'] = function_exists('opcache_get_status') ? (bool)@opcache_get_status(false)['opcache_enabled'] : null;
$out['ini_validate_ts'] = ini_get('opcache.validate_timestamps');
$out['ini_revalidate'] = ini_get('opcache.revalidate_freq');
$out['ini_opcache_on'] = ini_get('opcache.enable');
if (function_exists('opcache_get_status')) {
$st = @opcache_get_status(true);
if (!empty($st['scripts'])) {
foreach ($st['scripts'] as $path => $info) {
if (strpos($path, '/application/route.php') !== false) {
$out['opcache_cached_route'] = [
'path' => $path,
'timestamp' => date('c', $info['timestamp']),
'hits' => $info['hits'],
];
}
}
}
}
echo json_encode($out, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
exit;
}