This article mainly introduces the PHP does not use the copy () function copy the file The method, involves the PHP reads and writes the file The skill, has certain reference value, the need friend may refer to under
The example in this article describes how PHP does not copy files using the copy () function. Share to everyone for your reference. Specifically as follows:
The following code does not use PHP's built-in copy function to copy files directly from a file read write operation
?
| 1 2 3 4 5 6 7 8 9 10 11-12 |
<?php function CopyFiles ($file 1, $file 2) {$contentx = @file_get_contents ($file 1); $openedfile = fopen ($file 2, "w"); Fwrite ($openedfile, $contentx); Fclose ($openedfile); if ($contentx = = FALSE) {$status =false;} else $status =true; return $status; }?> |
I hope this article will help you with your PHP program design.