码迷,mamicode.com
首页 > 其他好文 > 详细

文件处理

时间:2015-07-27 14:45:13      阅读:90      评论:0      收藏:0      [点我收藏+]

标签:

写入文件:

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

文件处理

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!