thinkphp 清理runtime缓存的方法, 清理指定目录

https://blog.csdn.net/qq_22823581/article/details/79081497

hinkphp 清理runtime缓存的方法, 清理指定目录

function delFileByDir($dir) {
   $dh = opendir($dir);
   while ($file = readdir($dh)) {
      if ($file != "." && $file != "..") {

         $fullpath = $dir . "/" . $file;
         if (is_dir($fullpath)) {
            delFileByDir($fullpath);
         } else {
            unlink($fullpath);
         }
      }
   }
   closedir($dh);
}
public function del() {
   delFileByDir(APP_PATH.'Runtime/');
   $this->success('删除缓存成功!',U('Admin/Index/index'));
}
原文地址:https://www.cnblogs.com/lxwphp/p/15454074.html