PHP copy function Tutorial _php tutorial

Source: Internet
Author: User
Let's take a look at the PHP copy function tutorial below.

Copy
(PHP 4, PHP 5)

Copy-Copy files

Describe
Boolean copy (string $ Source, string $ dest [, resource $ background])
Dest A copy source of the file.

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

Parameters

Source
The source file for the path.

Dest
Destination path. If Dest is a URL, the copy operation may fail if the wrapper does not support overwriting the existing file.

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

Background
Establish Stream_context_create () within the valid range of resources.


return value
Returns TRUE or FALSE for successful failure.

Modify

Release Notes
5.3.0 support for time.
4.3.0 sources and dest now possible URLs if "open wrapper" is enabled. See the fopen () function for more details.


Instance

Example of # 1copy ()

$file = ' example.txt ';
$newfile = ' Example.txt.bak ';

if (!copy ($file, $newfile)) {
echo "Failed to copy $file ... n";
}
?>


http://www.bkjia.com/PHPjc/445489.html www.bkjia.com true http://www.bkjia.com/PHPjc/445489.html techarticle Let's take a look at the PHP copy function tutorial below. Copy (PHP 4, PHP 5)-Copy file Description Boolean copy (string $ Source, string $ dest [, resource $ background]) to make ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.