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

 

posted @ 2018-08-15 14:51  码农编程进阶笔记  阅读(102)  评论(0编辑  收藏  举报
返回顶部 有事您Q我