PHP
function copy_module_file($path,$newp){ 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")){ copy_module_file("$path/$file","$newp/$file"); } else{ copy("$path/$file","$newp/$file"); } } } closedir($handle); } }} if (is_dir("$path/$file")){
改为:
if (is_dir("$path/$file") && in_array($file,array('1','2','3','4'))){ 再问一下,如果不想复制根目录里的,test.txt文件只复制1,2,3,4目录,应该怎么再改一下,??
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号