zoukankan      html  css  js  c++  java
  • 文件夾及文件操作

    //递归删除文件夹及子文件夹里的文件
    //
    递归删除add by Helin function deldir($dir_path){ $dir=opendir($dir_path); while($file=readdir($dir)){ if($file!="." && $file!="..") { $fullpath=$dir_path."/".$file; if(!is_dir($fullpath)) {
                unlink($fullpath); } else {
                deldir($fullpath);
              } } }
    closedir($dir); rmdir($dir_path); return true; }
    //獲取文件夾內所有文件的文件名稱:
    $dir
    = '../xml_popup/'; $handle = opendir($dir."."); $code = ''; while(false !== ($file = readdir($handle)) ){ if($file != '.' && $file != '..'){ $code .= ','.$file; } } closedir($handle); $fp = @fopen('array_code.php',"wb"); fwrite($fp,$code); fclose($fp); echo 'ok';
  • 相关阅读:
    Shiro权限验证
    5种设计模式整理
    多模块的SpringBoot项目
    Go使用数据库
    使用Go mod
    docker基本使用
    Go的IO操作
    实现一个网盘存储……
    Go的网络编程
    学习golang的历程
  • 原文地址:https://www.cnblogs.com/helin/p/2578538.html
Copyright © 2011-2022 走看看