note 36419 deleted from function.rmdir by vincent
| From: | vincent@php.net | Date: | Thu, 09 Oct 2003 10:58:08 +0000 |
| Subject: | note 36419 deleted from function.rmdir by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58108@lists.php.net to get a copy of this message | ||
Note Submitter: springchun@21cn.com(by 21ks.com)
----
<?php
function del($path){
//del a file or rm a dir,del($path)=unlink($path)+rmdir($path)
//del all $path's file and dir
@chmod($path,0777);
if(is_dir($path)){
substr($path,-1)=='/' or $path.='/';
if($fp=@dir($path)){
while($f=$fp->read())if($f!='.'&&$f!='..')del($path.$f);
$fp->close();
}
return @rmdir($path);
}
else return @unlink($path);
}
?>