Home  >  Article  >  CMS Tutorial  >  How to turn off cache in phpcms v9

How to turn off cache in phpcms v9

藏色散人
藏色散人Original
2019-12-27 10:44:553115browse

How to turn off cache in phpcms v9

How to turn off the cache in phpcms v9

Remove the template cache of phpcms

I recently used phpcms to make a simple thing. Because it was too simple, I debugged it directly on ftp. However, I uploaded the template file, but the front desk never refreshed. I went to the cache directory to delete the generated cache php, and went back and forth. I felt very annoyed after doing it several times, but I couldn’t find any suitable articles on the Internet to turn it off, so I just simply and crudely cleared the cache first

There is a function named

in global.func.php
function template($module = 'content', $template = 'index', $style = '')
  if (file_exists(PC_PATH . 'templates' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $template . '.html'))
  {
      if (!file_exists($compiledtplfile) || (@filemtime(PC_PATH . 'templates' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $template . '.html') > @filemtime($compiledtplfile)))
      {
          $template_cache->template_compile($module, $template, $style);
      }
  }

Just remove the if inside. How simple and crude it is. This way, you need to compile it every time. But for a simple small project, you don’t need to pay too much attention to it.

  if (file_exists(PC_PATH . 'templates' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $template . '.html'))
  {
    //  if (!file_exists($compiledtplfile) || (@filemtime(PC_PATH . 'templates' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $template . '.html') > @filemtime($compiledtplfile)))
     // {
          $template_cache->template_compile($module, $template, $style);
     // }
  }

PHP Chinese website, A large number of free PHPCMS tutorials, welcome to learn online!

The above is the detailed content of How to turn off cache in phpcms v9. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn