zoukankan      html  css  js  c++  java
  • php删除目录及目录下文件

    function del_dir ($dir,$type=true)
    {
        $n=0;
        if (is_dir($dir)) {
            if ($dh = opendir($dir)) {
                while (($file = readdir($dh)) !== false) {
                    if ( $file == '.' or $file =='..')
                    {
                        continue;
                    }
                    if (is_file ($dir.$file))
                    {
                        unlink($dir.$file);
                        $n++;
                    }
                    if (is_dir ($dir.$file))
                    {
                        del_dir ($dir.$file.'/');
                        if ($type)
                        {
                            $n++;
                            rmdir($dir.$file.'/');
                        }
                    }
                }
            }
            closedir($dh);
        }
        return $n;
    }
  • 相关阅读:
    sqlalchemy 使用pymysql连接mysql 1366错误
    mysql之数据导出
    Go常见语句
    huffman code
    后缀数组,目前比较赶进度,而且有点难,所以放到以后再来看
    hash
    bipartite matching
    spanning tree
    拓扑排序
    Union Find
  • 原文地址:https://www.cnblogs.com/kwishly/p/2435009.html
Copyright © 2011-2022 走看看