note 36418 deleted from function.unlink by vincent
| From: | vincent@php.net | Date: | Thu, 09 Oct 2003 11:03:54 +0000 |
| Subject: | note 36418 deleted from function.unlink by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58111@lists.php.net to get a copy of this message | ||
Note Submitter: springchun@21cn.com
----
<?php
function del($path){
//del a file or rm a dir,del($path)=unlink($path)+rmdir($path)
@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);
}
?>