The example in this article describes the implementation method of php directory copy. 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');
-
-
Copy code
I hope this article will be helpful to everyone’s PHP programming design.
|