'
. '
'
. '
还差一步:没有找到 config.php
'
. '
'
. '请复制同目录下的 config.example.php 为 config.php,'
. '填好数据库连接与 app_key 后再访问。
'
. '
';
exit;
}
$GLOBALS['config'] = require $configFile;
// ---------------- 错误报告(线上不显示错误,避免泄露路径与库信息)----------------
$debug = !empty($GLOBALS['config']['debug']);
error_reporting(E_ALL);
ini_set('display_errors', $debug ? '1' : '0');
ini_set('log_errors', '1');
// ---------------- 时区:日期是家书的核心数据,一开始就必须明确 ----------------
date_default_timezone_set($GLOBALS['config']['timezone'] ?? 'Asia/Shanghai');
// ---------------- 安全响应头 ----------------
// Referrer-Policy: 跨域取图不带 Referer —— 这一条能兜住云存储防盗链
// 导致的「图片不显示、但地址栏直接打开没问题」那类怪异现象。
if (!headers_sent()) {
header('Referrer-Policy: same-origin');
header('X-Content-Type-Options: nosniff');
}
// ---------------- 会话 ----------------
$isHttps = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https');
session_name('fbsid');
session_set_cookie_params([
'lifetime' => 0,
'path' => '/',
'secure' => $isHttps,
'httponly' => true,
'samesite' => 'Lax',
]);
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
require FB_APP . '/helpers.php';