Home > Article > Backend Development > What is the purpose of php copy() function?
copy() Function in php is mainly used to copy files. Its syntax is as follows
copy(source,destination)
Description | |
---|---|
Required. Specifies the files to be copied. | |
Required. Specifies the destination for copied files. |
$file_path='file/pdf/20170811.pdf'; $to_file_path='down/pdf/20170811.copy.pdf'; if(copy($file_path,$to_file_path)){ echo 'copy ok'; }else{ echo 'error'; }Copy
$file_url='php.cn/xx/f1.mp4'; $local_file_path = 'file/mp4/f1.mp4'; if(copy($file_url,$local_file_path)){ echo 'down ok'; }else{ echo 'error' }
The above is the detailed content of What is the purpose of php copy() function?. For more information, please follow other related articles on the PHP Chinese website!