文件处理

写入文件:

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);
}

原文地址:https://www.cnblogs.com/lyy-php/p/4679961.html