将 "source.txt" 复制到 "target.txt":
<?php
echo copy("source.txt","target.txt");
?>
copy() 函数复制文件。
笔记:如果到文件文件已存在,它将被覆盖。
copy(
from_file,
to_file,
context)
Parameter | Description |
---|---|
from_file | Required. Specifies the path to the file to copy from |
to_file | Required. Specifies the path to the file to copy to |
context | Optional. Specifies a context resource created with stream_context_create() |
返回值: | TRUE 成功,FALSE 失败 |
---|---|
PHP 版本: | 4.0+ |
PHP 变更日志: | PHP 5.3 - 添加context范围 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!