如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
<?php
header("contnet-type:text/html;charset=utf-8");
date_default_timezone_set('PRC');
function copydir ($src, $dst)
{
//判断目录是否存在不存在就创建
if(!file_exists($dst)){
mkdir($dst, 0777, true);
}
$res = opendir($src);
while(false !== ($filename = readdir($res))){
if($filename == '.' || $filename == '..'){
continue;
}
$src_path = rtrim($src, '/') . '/' . $filename;
$dst_path = rtrim($dst, '/') . '/' . $filename;
if(is_dir($src_path)){
copydir($src_path, $dst_path);
}
if(is_file($src_path)){
copy($src_path, $dst_path);
}
}
closedir($res);
return true;
}
copydir('../1124','./t');
王明昌博客
