本文實(shí)例講述了php目錄拷貝實(shí)現(xiàn)方法。分享給大家供大家參考。具體如下:
function copy_dir($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
copy_dir($src . '/' . $file,$dst . '/' . $file);
continue;
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}
copy_dir('e:/www/chat','e:/www/chat3');
希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選