1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
public
function
delDir(){
$dirName
=
$_SERVER
[
'DOCUMENT_ROOT'
].
'/目录'
;
$this
->delDirAndFile(
$dirName
);
}
function
delDirAndFile(
$dirName
){
if
(
$handle
=opendir(
$dirName
)){
while
(false!==(
$item
=readdir(
$handle
))){
if
(
$item
!=
"."
&&
$item
!=
".."
){
if
(
is_dir
(
"$dirName/$item"
)){
$this
->delDirAndFile(
"$dirName/$item"
);
}
else
{
unlink(
"$dirName/$item"
);
}
}
}
closedir
(
$handle
);
rmdir
(
$dirName
);
}
}
|
本文转自噼里啪啦啦 51CTO博客,原文链接:http://blog.51cto.com/pilipala/2048431
,如需转载请自行联系原作者