From 9b081a6853c3ccd906717d043360ade53e2ee684 Mon Sep 17 00:00:00 2001 From: ypsdf1 Date: Wed, 25 Nov 2026 16:01:28 +0800 Subject: [PATCH] =?UTF-8?q?15m44v=20=E7=BB=AD:=20gh=5Fapi.php=20=E5=8A=A0?= =?UTF-8?q?=E5=BA=93=E6=96=87=E4=BB=B6=E8=87=AA=E5=A4=B1=E6=95=88(opcache?= =?UTF-8?q?=5Finvalidate=20=5F=5FFILE=5F=5F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gh_api.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gh_api.php b/gh_api.php index e84e71f..0b46677 100644 --- a/gh_api.php +++ b/gh_api.php @@ -19,6 +19,13 @@ if (!defined('GH_TICKET_PREFIX')) { define('GH_TICKET_PREFIX', '[工单#'); // 后接 id + "] " } +// ★ 15m44v: 库文件自失效 —— 每次被 require 时 invalidate 自身 OPcache 副本。 +// 部署 gh_api.php 后,只要任一入口(ticket.php/gh_oauth.php)再 require 一次, +// 就强制重读磁盘新版,避免旧版常驻 OPcache 导致新逻辑(占位符替换/ghLog 路径/ +// Cache-Control 头)不生效。入口顶部已有 opcache_invalidate(__FILE__),但库文件 +// 需自失效自身路径,双保险。 +if (function_exists('opcache_invalidate')) { @opcache_invalidate(__FILE__, true); } + /** 取 img.json 的 GitHub 配置(懒重载) */ function ghGetCfg() { return loadImgJson();