ѡ̳

 找回密码
 ע
搜索
查看: 195|回复: 0
打印 上一主题 下一主题

PHP复制目录和文件

[复制链接]

789

主题

1158

帖子

4197

积分

Ա

Rank: 9Rank: 9Rank: 9

积分
4197
跳转到指定楼层
¥
发表于 2018-11-8 18:32:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

//xCopy('./webcase/wumei/','./usecase/wumei/',1);

function xCopy($source, $destination, $child){

if(!is_dir($source)){

echo "Error:the $source is not a direction!" ;
return 0;
}


if(!is_dir($destination)){
     mkdir($destination,0777);
}

   $handle=dir($source);

while($entry=$handle->read()){

    if(($entry!=".")&&($entry!="..")){
        if(is_dir($source."/".$entry)){
            if($child)
             xCopy($source."/".$entry,$destination."/".$entry,$child);
          }
       else{
              copy($source."/".$entry,$destination."/".$entry);
                   }
      }
   }

    return 1;
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | ע

本版积分规则

QQ|Archiver|ֻ|С|ѡ̳

GMT+8, 2026-5-2 07:55 , Processed in 0.082579 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表
0.0973s