diff --git a/code/app/services/SiteContext.php b/code/app/services/SiteContext.php index b883acd..69c05d7 100644 --- a/code/app/services/SiteContext.php +++ b/code/app/services/SiteContext.php @@ -190,6 +190,9 @@ class SiteContext // 1. 站点 DNA $TpStyle = $this->TpStyle; + define('SITE_SEED', $TpStyle['seed']); // 你已有的站点 seed + + // 3. 构建本域名 CSS(合并并替换 __PFX__) $strCssUrl = CssBuilder::build( $TpStyle['css_files'], diff --git a/code/config/view.php b/code/config/view.php index bf7378a..0027bdf 100644 --- a/code/config/view.php +++ b/code/config/view.php @@ -35,6 +35,11 @@ return [ // 是否开启模板编译缓存,设为false则每次都会重新编译 'tpl_cache' => env('VIEW_TPL_CACHE', false), + // ⭐⭐⭐ 关键:模板编译缓存隔离前缀(防止多域名串模板) + 'cache_prefix' => md5( + ($_SERVER['HTTP_HOST'] ?? 'cli') . '|' . (defined('SITE_SEED') ? SITE_SEED : '') + ), + //页面数据缓存 'view_data_cache' => env('VIEW_DATA_CACHE', false),