Copy
(PHP 4 and PHP 5)
Copy-Copy an object
Description
Boolean copy (string $ Source, string $ dest [, resource $ background])
Make the file a copy source dest.
If you want to move the file, use the rename () function.
Parameters
Source
Path source file.
Dest
Destination path. If dest is a Web site, the copy operation may fail. If the package does not support overwriting existing files.
Warning
If the target file already exists, it will be overwritten.
Background
Create stream_context_create () within the effective range of the resource ().
Return value
Returns TRUE or FALSE.
Modify
Version description
5.3.0 time support.
4.3.0 source and dest may now be URLs if "open package" is enabled. For more information about the fopen () function, see.
Instance
Example of #1 copy ()
<? Php
$ File = 'example.txt ';
$ Newfile = 'example.txt. bak ';
If (! Copy ($ file, $ newfile )){
Echo "failed to copy $ file... n ";
}
?>