HEL-580: version asset URLs to bust stale browser caches
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<html lang="zh-CN"><head><meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>金牛集团贷款档案管理系统 - 登录</title>
|
||||
<link rel="stylesheet" href="assets/fusion.css">
|
||||
<script src="assets/fusion.js" defer></script>
|
||||
<link rel="stylesheet" href="<?= assetUrl('assets/fusion.css') ?>">
|
||||
<script src="<?= assetUrl('assets/fusion.js') ?>" defer></script>
|
||||
</head><body>
|
||||
<div class="v-fusion" data-variant-root>
|
||||
<script>(function(){try{if(localStorage.getItem('jn_theme')==='night'){document.currentScript.parentElement.setAttribute('data-theme','night');}}catch(e){}})();</script>
|
||||
|
||||
Reference in New Issue
Block a user