PHP目录/文件拷贝/复制自定义函数分享
发布时间:2017-10-25 编辑:jiaochengji.com
教程集为您提供PHP目录/文件拷贝/复制自定义函数分享等资源,欢迎您收藏本站,我们将为您提供最新的PHP目录/文件拷贝/复制自定义函数分享资源
文件夹文件拷贝/复制函数如下
<pre class=\"brush:php;toolbar:false\">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; } ?></pre>
您可能感兴趣的文章:
PHP目录/文件拷贝/复制自定义函数分享
XCOPY命令如何只拷贝当天文件
批处理 if命令的用法举例
CP命令用法示例
Python常用模块之shutil
PHP删除N分钟前创建的所有文件的小例子
php ftp类(上传、下载、复制、移动等)
模拟xcopy的函数
【PHP学习】新手必备PHP常用函数大集合
php柱状图(JpGraph类库)的生成方法分享
[关闭]