PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<clearstatcachedelete>
Last updated: Mon, 16 Jul 2012

copy

(PHP 3, PHP 4, PHP 5)

copy -- 拷贝文件

说明

bool copy ( string source, string dest )

将文件从 source 拷贝到 dest。如果成功则返回 TRUE,失败则返回 FALSE

例子 1. copy() 例子

<?php
if (!copy($file, $file.'.bak')) {
   print (
"failed to copy $file...<br>\n");
}
?>

注: 从 PHP 4.3.0 开始,如果启用了“fopen wrappers”的话,sourcedest 都可以是 URL。更多细节见 fopen()。如果 dest 是一个 URL,则如果封装协议不支持覆盖已有的文件时拷贝操作会失败。

警告

如果目标文件已存在,将会被覆盖。

参见 move_uploaded_file()rename() 和手册中关于文件上传处理一节。




<clearstatcachedelete>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST