模拟xcopy的函数

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

模拟xcopy的函数

  2021-03-16 我要评论
想了解模拟xcopy的函数的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:|模拟|拟x|xc|co|op|py|y的|的函|函数|数|,下面大家一起来学习吧。

模拟xcopy的函数 <?php
/*************************************
* 系统名称:模拟xcopy的函数
* 程序功能:模拟xcopy的函数
* 开发日期:2003/03/14
*************************************/
?>
<?
//copy a direction's all files to another direction
function xCopy($source, $destination, $child){
//用法:
// xCopy("feiy","feiy2",1):拷贝feiy下的文件到 feiy2,包括子目录
// xCopy("feiy","feiy2",0):拷贝feiy下的文件到 feiy2,不包括子目录
//参数说明:
// $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;
}

?>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们