文件处理

写入文件:

function writefile($path,$value){
$hand = fopen($path,'a');
fwrite($hand,$value);
@fclose($hand);
}

删除文件:

function deletefile(){
$dir = str_replace('\\','/',dirname(__FILE__)).'/dir';
$dh=opendir($dir);
while (false !== ($file=readdir($dh))) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)){
unlink($fullpath);
}
}
}
closedir($dh);
}

posted @ 2015-07-27 13:57  梁小粽  阅读(108)  评论(0编辑  收藏  举报