PHP删除指定文件夹所有文件代码
删除指定文件夹所有文件
代码如下 | 复制代码 |
$cacheDir = '../cache/runtime'; if (($file == '.') || ($file == '..')) { continue; } if (file_exists( $cacheDir . '/' .$file)) { |
上面只能删除目录中的文件,不能删除目录中的目录或目录下的文件,我这里既然讲到也给大家提供一个函数
代码如下 | 复制代码 |
function deltree($dirList){ |
上面使用的是递归遍历目录然后进行删除文件再删除目录了
文章地址:
转载随意^^请带上本文地址!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
