原因: 緩存問題
找到 thinkphp\library\think\Template.php
找到 public function fetch($template, $vars = [], $config = [])
if ($template) { $cacheFile = $this->config['cache_path'] . $this->config['cache_prefix'] . md5($this->config['layout_name'] . $template) . '.' . ltrim($this->config['cache_suffix'], '.'); // if (!$this->checkCache($cacheFile)) { 將此if判斷注釋掉 // 緩存無效 重新模板編譯 $content = file_get_contents($template); $this->compiler($content, $cacheFile); // } // 頁面緩存 ob_start(); ob_implicit_flush(0); // 讀取編譯存儲 $this->storage->read($cacheFile, $this->data); // 獲取並清空緩存 $content = ob_get_clean(); if (!empty($this->config['cache_id']) && $this->config['display_cache']) { // 緩存頁面輸出 Cache::set($this->config['cache_id'], $content, $this->config['cache_time']); } echo $content; }
1