From 0e2e5f02de3abf8bb7dc70c6bef3d086c6ff77ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=8E=E6=9C=AF=E5=B8=88?= Date: Fri, 18 Sep 2026 19:52:34 +0800 Subject: [PATCH] HEL-580: version asset URLs to bust stale browser caches Co-authored-by: multica-agent --- app/helpers.php | 8 ++++++++ app/views/pages/login.php | 4 ++-- public/index.php | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index d46a2ea..6f30323 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -6,6 +6,14 @@ function e(string $v): string return htmlspecialchars($v, ENT_QUOTES, 'UTF-8'); } +/** 静态资源引用统一加版本号(文件 mtime):文件一变 URL 即变,老用户浏览器无需清缓存 */ +function assetUrl(string $path): string +{ + $file = __DIR__ . '/../public/' . ltrim($path, '/'); + $v = is_file($file) ? filemtime($file) : 0; + return $path . '?v=' . $v; +} + function now(): string { return date('Y-m-d H:i:s'); diff --git a/app/views/pages/login.php b/app/views/pages/login.php index 9c8db99..db65db8 100644 --- a/app/views/pages/login.php +++ b/app/views/pages/login.php @@ -21,8 +21,8 @@ 金牛集团贷款档案管理系统 - 登录 - - + +
diff --git a/public/index.php b/public/index.php index 7871a9b..134fd31 100755 --- a/public/index.php +++ b/public/index.php @@ -114,8 +114,8 @@ function pageHeader(array $me, ?int $taskCount = null): void 金牛集团贷款档案管理系统 - - + +