Home  >  Article  >  Backend Development  >  How to click copy in php

How to click copy in php

藏色散人
藏色散人Original
2019-10-30 09:06:363715browse

How to click copy in php

How to click copy in php?

php can use the copy() function to implement the copy function. The copy() function is used to copy files.

copy() syntax

copy(source,destination)

Parameters

source required. Specifies the files to be copied.

destination Required. Specifies the destination for copied files.

Instructions

Copy files from source to destination. Returns TRUE if successful, FALSE otherwise.

Tips and Notes

Tip: If you want to move the file, please use the rename() function.

Note: Starting from PHP 4.3.0, if "fopen wrappers" is enabled, both source and destination can be URLs. See fopen() for more information. If destination is a URL, the copy operation will fail if the encapsulating protocol does not support overwriting existing files.

Important: If the target file already exists, it will be overwritten.

Example

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

Output:

1

For more PHP related knowledge, please visit the PHP Chinese website!

The above is the detailed content of How to click copy in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn