tp5 修改配置參數 view_replace_str 無效


原因: 緩存問題

 

 

 

找到  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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM