copy('foo/test.php', 'bar/test.php');
Above is the code which will transfer the test.php file from foo
to bar
and so overwrite any files if necessary.
I am trying to achieve the above but with several, undefined directories. How would I go about doing so?
Overall
foo
. I would appreciate any help, thanks!
as written you can pass one array in arguments and loops on it like that :
function fullCopy($oldDir = '', $newDir = []) {
foreach ($dir as $value){
if ( is_dir($oldDir && is_dir($newDir)) ) {
copy( $oldDir . '/test.php', $newDir . '/test.php');
}
}
}
fullCopy('foo', ['bar', 'bar2', 'bar3']);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.