超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<clearstatcachedelete>
Last updated: Fri, 22 Jun 2007

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() 和手册中关于文件上传处理一节。




add a note add a note User Contributed Notes
copy
kadnan at yahoo dot com
30-Aug-2004 01:30
you can also try xcopy command by using Shell to move/copy files/folders from one place to another
here is the code:

<?php
exec('xcopy c:\\myfolder d:\\myfolder /e/i', $a, $a1);
?>

by executing this command, it will move folder along with all contents to destination.

-adnan

<clearstatcachedelete>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22