1 Star 0 Fork 0

justwkj / code-snippet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rm.php 567 Bytes
一键复制 编辑 原始数据 按行查看 历史
wangkeji 提交于 2017-06-05 13:51 . added 删除文件或目录
<?php
//删除文件和目录
$dir = 'D:\gitrepo\mazntest\Application\Runtime';
//循环删除目录和文件函数
unlinkRecursive($dir, 0);
function unlinkRecursive($dir, $deleteRootToo){
if (!$dh = @opendir($dir)) {
return;
}
while (false !== ($obj = readdir($dh))) {
if ($obj == '.' || $obj == '..') {
continue;
}
if (!@unlink($dir . '/' . $obj)) {
unlinkRecursive($dir . '/' . $obj, true);
}
}
closedir($dh);
if ($deleteRootToo) {
@rmdir($dir);
}
return;
}
PHP
1
https://gitee.com/justwkj/code-snippet.git
git@gitee.com:justwkj/code-snippet.git
justwkj
code-snippet
code-snippet
master

搜索帮助