copy

(PHP 4, PHP 5, PHP 7)

copy锟斤拷锟斤拷锟侥硷拷

说锟斤拷

copy ( string $source , string $dest [, resource $context ] ) : bool

锟斤拷锟侥硷拷锟斤拷 source 锟斤拷锟斤拷锟斤拷 dest锟斤拷

锟斤拷锟揭拷贫锟斤拷募锟斤拷幕锟斤拷锟斤拷锟绞癸拷锟� rename() 锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷

source

源锟侥硷拷路锟斤拷锟斤拷

dest

目锟斤拷路锟斤拷锟斤拷锟斤拷锟� dest 锟斤拷一锟斤拷 URL锟斤拷锟斤拷锟斤拷锟斤拷锟阶靶拷椴恢э拷指锟斤拷锟斤拷锟斤拷械锟斤拷募锟绞憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞э拷堋锟�

Warning

锟斤拷锟侥匡拷锟斤拷募锟斤拷汛锟斤拷冢锟斤拷锟斤拷岜伙拷锟斤拷恰锟�

context

A valid context resource created with stream_context_create().

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
5.3.0 锟斤拷锟斤拷锟剿讹拷 context 锟斤拷支锟街★拷
4.3.0 锟斤拷锟斤拷锟斤拷锟斤拷锟�"fopen wrappers"锟侥伙拷锟斤拷source 锟斤拷 dest 锟斤拷锟斤拷锟斤拷锟斤拷 URL锟斤拷锟斤拷锟斤拷细锟节硷拷 fopen()锟斤拷

锟斤拷锟斤拷

Example #1 copy() 锟斤拷锟斤拷

<?php
$file 
'example.txt';
$newfile 'example.txt.bak';

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

锟轿硷拷