Tp5.1 管理后台开发纪要

1. tp5.1 对网页是有缓存机制的

E:phpStudyPHPTutorialWWWNewAdmin hinkphplibrary hinkTemplate.php

下display方法 如果缓存内有所请求的页面则 使用,这也是为什么自己添加上了很多东西, 所请求页面没有变化的原因

在tp根目录运行清除缓存命令问题解决

php think clear   
 /**
     * 渲染模板内容
     * @access public
     * @param  string    $content 模板内容
     * @param  array     $vars 模板变量
     * @param  array     $config 模板参数
     * @return void
     */
    public function display($content, $vars = [], $config = [])
    {
        if ($vars) {
            $this->data = $vars;
        }

        if ($config) {
            $this->config($config);
        }

        $cacheFile = $this->config['cache_path'] . $this->config['cache_prefix'] . md5($content) . '.' . ltrim($this->config['cache_suffix'], '.');

        if (!$this->checkCache($cacheFile)) {  //此处是说检查一下缓存内有无上次请求的页面如果没有,则重新生成. 否则就用以前的.
            // 缓存无效 模板编译
            $this->compiler($content, $cacheFile);
        }
原文地址:https://www.cnblogs.com/zuochanzi/p/11425299.html