建站软件 优化软件 编程软件 网页辅助 站群程序 网站程序 图像处理 资源教程 字体下载 推荐软件


您的位置:首页 > PHP学习 > PHP多重判断删除文件函数代码

PHP多重判断删除文件函数代码

时间:2015-01-29 16:05:52  来源:免费模板网 作者:风雪 阅读次数 tagsPHP多重判断删除文件函数代码

      分享一例php多重判断条件下删除文件的函数代码,很简单的,主要是包括权限判断、文件存在与否等,有需要的朋友参考下吧

function delete_file($file
03.
04.    if (file_exists($file)) 
05.    
06.        $delete = chmod ($file, 0777); 
07.        $delete = unlink($file); 
08.        if(file_exists($file)) 
09.        
10.            $filesys = eregi_replace("/","\\",$file); 
11.            $delete = system("del $filesys"); 
12.            clearstatcache(); 
13.            if(file_exists($file)) 
14.            
15.                $delete = chmod ($file, 0777); 
16.                $delete = unlink($file); 
17.                $delete = system("del $filesys"); 
18.            
19.        
20.        clearstatcache(); 
21.        if(file_exists($file)) 
22.        
23.            return 'Delete Faile         :        <font color=\'#ff0000\'-->'.$file.'
24.'; 
25.        
26.        else 
27.        
28.            return 'Delete Successs        :        '.$file.'
29.'; 
30.        
31.    
32.    else 
33.    
34.        return 'Delete Successs        :        '.$file.'
35.'; 
36.    
37.}

本文地址:https://www.freemoban.com/php/2015/0129/348.html

猜你喜欢
栏目推荐
模板推荐

Copyright:www.freemoban.com 免费模板网 All Rights Reserved 网站备案:辽ICP备19014872号-2   辽公网安备 21010602000376号  辽公网安备:42900402000182号

免责声明:本站部分资源来自互联网收集,版权归原创者所有,如果侵犯了你的权益,我们会及时删除侵权内容,联系QQ:1615187561 谢谢合作!