Latest web development tutorials

PHP copy () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

copy () function copies files.

If successful the function returns TRUE, on failure returns FALSE.

grammar

copy(file,to_file)

参数 描述
file 必需。规定要复制的文件。
to_file 必需。规定复制文件的目的地。


Tips and Notes

Note: If thetarget file already exists, it will be overwritten.


Examples

<?php
echo copy("source.txt","target.txt");
?>

The code above will output:

1


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual