如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<?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'); |