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'));
}

 

相关文章:

  • 2022-12-23
  • 2021-07-14
  • 2022-01-27
  • 2021-11-21
  • 2021-11-21
  • 2021-11-21
  • 2022-01-07
猜你喜欢
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2021-12-13
相关资源
相似解决方案