php教程|php手册
php,删除,文件夹,及其,下,所,文件,函数,代码,复制,代码,如下,function,deldir,dir,先
php教程-php手册
复制代码 代码如下:
tightvnc 源码解析,ubuntu终端支持中文,俄罗斯小爬虫,标签,杭州seo标准lzw
<?
function deldir($dir) {
//先删除目录下的文件:
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!=”.” && $file!=”..”) {
$fullpath=$dir.”/”.$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
closedir($dh);
//删除当前文件夹:
if(rmdir($dir)) {
return true;
} else {
return false;
}
}
?>
php装修企业网站源码,怎么同步vscode插件,平板 刷ubuntu,tomcat中启动灰色,爬虫 图书,php数组中某个键值,盐田seo优化推广价格,前沿企业网站源码,苹果cms影院模板lzw
实例:删除某个文件夹下的所有“.svn”文件夹(包括其内容也要被删除).
小区物业管理系统设计 源码,ubuntu开启不了终端,注册表找不到tomcat,爬虫群微信,什么是php预处理器,通化seo服务lzw
复制代码 代码如下:
<?php
function delsvn($dir) {
$dh=opendir($dir);
//找出所有”.svn“ 的文件夹:
while ($file=readdir($dh)) {
if($file!=”.” && $file!=”..”) {
$fullpath=$dir.”/”.$file;
if(is_dir($fullpath)) {
if($file==”.svn”){
delsvndir($fullpath);
}else{
delsvn($fullpath);
}
}
}
}
closedir($dh);
}
function delsvndir($svndir){
//先删除目录下的文件:
$dh=opendir($svndir);
while($file=readdir($dh)){
if($file!=”.”&&$file!=”..”){
$fullpath=$svndir.”/”.$file;
if(is_dir($fullpath)){
delsvndir($fullpath);
}else{
unlink($fullpath);
}
}
}
closedir($dh);
//删除目录文件夹
if(rmdir($svndir)){
return true;
}else{
return false;
}
}
$dir=dirname(__FILE__);
//echo $dir;
delsvn($dir);
?>