search
Homephp教程php手册如何清除TP的文件缓存

很多时候,当我们在操作过程中,调整了表结构或者需要因为特殊的原因手动清理掉某些缓存文件时,需要用到这个方法。仅限于File缓存的方式。
很多时候,当我们在操作过程中,调整了表结构或者需要因为特殊的原因手动清理掉某些缓存文件时,需要用到这个方法。仅限于File缓存的方式。

如果要删除其他的缓存也是可以的,你可以去找一下TP的系统变量,里面有其他几个缓存目录的常量。

使用方法,直接用调用cache_clear方法即可。写的比较简单,如果需要请自行扩充,另外,很多教程里说,要用到IO类来删除缓存,可惜的是TP的3.1版本之后都没看到这个类在那里。或许是我没找到。public function cache_clear() {<br>         $this->deldir(TEMP_PATH);<br>     }<br> <br>     function deldir($dir) {<br>         $dh = opendir($dir);<br>         while ($file = readdir($dh)) {<br>             if ($file != "." && $file != "..") {<br>                 $fullpath = $dir . "/" . $file;<br>                 if (!is_dir($fullpath)) {<br>                     unlink($fullpath);<br>                 } else {<br>                     deldir($fullpath);<br>                 }<br>             }<br>         }<br>     }

AD:真正免费,域名+虚机+企业邮箱=0元

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment