PHP多重判断删除文件函数代码
时间:2021-07-01 10:21:17
帮助过:18人阅读
- /**
- * func: delete_file
- * params: $file 文件名称
- * 多重条件判断 删除文件
- * by bbs.it-home.org
- */
- function delete_file($file)
- {
- if (file_exists($file))
- {
- $delete = chmod ($file, 0777);
- $delete = unlink($file);
- if(file_exists($file))
- {
- $filesys = eregi_replace("/","\\",$file);
- $delete = system("del $filesys");
- clearstatcache();
- if(file_exists($file))
- {
- $delete = chmod ($file, 0777);
- $delete = unlink($file);
- $delete = system("del $filesys");
- }
- }
- clearstatcache();
- if(file_exists($file))
- {
- return 'Delete Faile : '.$file.'
'; - }
- else
- {
- return 'Delete Successs : '.$file.'
'; - }
- }
- else
- {
- return 'Delete Successs : '.$file.'
'; - }
- }
- ?>
|