当前位置:Gxlcms > PHP教程 > php目录拷贝实现方法

php目录拷贝实现方法

时间:2021-07-01 10:21:17 帮助过:18人阅读

本文实例讲述了php目录拷贝实现方法。分享给大家供大家参考。具体如下:

  1. function copy_dir($src,$dst) {
  2. $dir = opendir($src);
  3. @mkdir($dst);
  4. while(false !== ( $file = readdir($dir)) ) {
  5. if (( $file != '.' ) && ( $file != '..' )) {
  6. if ( is_dir($src . '/' . $file) ) {
  7. copy_dir($src . '/' . $file,$dst . '/' . $file);
  8. continue;
  9. }
  10. else {
  11. copy($src . '/' . $file,$dst . '/' . $file);
  12. }
  13. }
  14. }
  15. closedir($dir);
  16. }
  17. copy_dir('e:/www/chat','e:/www/chat3');

希望本文所述对大家的php程序设计有所帮助。

php

人气教程排行