Rumah >pembangunan bahagian belakang >tutorial php >php 复制目录,但目录下的子目录及文件没有复制?
copy_module_file("123","345",array('1','2','3','4')); function copy_module_file($path,$newp,$ex){ if(!is_dir($newp)){ mkdir($newp); } if (file_exists($path)){ if(is_file($path)){ copy($path,$newp); } else{ $handle = opendir($path); while (($file = readdir($handle))!='') { if (($file!=".") && ($file!="..") && ($file!="")){ if (is_dir("$path/$file") && in_array($file,$ex)){ //后面一段是复制指定目录 copy_module_file("$path/$file","$newp/$file"); } else{ copy("$path/$file","$newp/$file"); } } } closedir($handle); } }}
http://blog.csdn.net/lijpwsw/article/details/6790461