如何用php创建与删除多级目录函数
来源:程序员人生 发布时间:2013-11-03 18:52:04 阅读次数:2264次
-
- function deldir($dir)
- {
- $dh=opendir($dir);
- while ($file=readdir($dh))
- {
- if($file!="." && $file!="..")
- {
- $fullpath=$dir."/".$file;
- if(!is_dir($fullpath))
- {
- unlink($fullpath);
- }
- else
- {
- $this -> deldir($fullpath);
- }
- }
- }
- closedir($dh);
- if(rmdir($dir))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- function createFolder($path)
- {
- if (!file_exists($path)){
- createFolder(dirname($path));
- mkdir($path, 0777);
- }
- }
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠