zoukankan      html  css  js  c++  java
  • 级联删除的方法

    1. exec("rd /s /q y12");命令删除目录
    $path='y12/aa/bb/cd/ff/aa/ee/dd';
    //mkdir($path,0777,true);
    exec("rd /s /q y12");
    2.运用递归函数实现级联删除用时直接调用既可以
    $path='y12/aa/bb/cd/ff/aa/ee/dd';
    function delTree($dir) {
    $files = array_diff(scandir($dir), array('.','..'));
    foreach ($files as $file) {
    (is_dir("$dir/$file") && !is_link($dir)) ? delTree("$dir/$file") : unlink("$dir/$file");
    }
    return rmdir($dir);
    }
    delTree('y12');




  • 相关阅读:
    Spring----Day03
    Spring----Day02
    python
    python
    python
    python
    python
    python
    python
    python
  • 原文地址:https://www.cnblogs.com/lsr111/p/4507607.html
Copyright © 2011-2022 走看看