`/顶栏,塞进一段 innerHTML 里会直接坏掉结构。 */ public static function renderPartial(string $tpl, array $data = []): string { $file = dirname(__DIR__) . '/templates/' . $tpl . '.php'; if (!is_file($file)) { throw new \RuntimeException('模板不存在:' . $tpl); } extract($data, EXTR_SKIP); ob_start(); require $file; return (string)ob_get_clean(); } /** * 独立的整页(登录、安装、错误),不套顶栏 —— 但**仍然要是一份完整 HTML**。 * * ⚠️ 曾经这里直接 require $file,输出里没有 doctype / head / CSS, * 浏览器拿默认样式渲染,登录页看起来就像「完全没样式」。 * 现在统一套一层 layout-bare.php(无顶栏的最小骨架)。 */ public static function renderBare(string $tpl, array $data = []): void { $file = dirname(__DIR__) . '/templates/' . $tpl . '.php'; if (!is_file($file)) { throw new \RuntimeException('模板不存在:' . $tpl); } $tplFile = $file; $pageTitle = $data['title'] ?? '家书'; $extraHead = $data['extraHead'] ?? ''; extract($data, EXTR_SKIP); require dirname(__DIR__) . '/templates/layout-bare.php'; } }