Home >Backend Development >PHP Tutorial >Implementation method of php directory copy, php directory copy_PHP tutorial

Implementation method of php directory copy, php directory copy_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:46:53804browse

php directory copy implementation method, php directory copy

This article describes the example of php directory copy implementation method. Share it with everyone for your reference. The details are as follows:

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');

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1030139.htmlTechArticlephp directory copy implementation method, php directory copy This article describes the php directory copy implementation method. Share it with everyone for your reference. The details are as follows: function copy_dir($src,$dst) { $di...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn