PHP的copy函数如何应用于长尾关键词的文件复制案例?
- 内容介绍
- 文章标签
- 相关推荐
本文共计425个文字,预计阅读时间需要2分钟。
plaintextcopy - 复制文件copy(string $source, string $dest[, resource $context]): bool将文件从source复制到dest。如果需要移动文件,请使用rename()函数。参数:source - 源文件路径。dest - 目标文件路径。如果dest是字符串php://temp,则不会保存文件。
copy—拷贝文件
说明
copy(string$source,string$dest[,resource$context] ) :bool
将文件从source拷贝到dest。
如果要移动文件的话,请使用rename()函数。
参数
source
源文件路径。
dest
目标路径。如果dest是一个 URL,则如果封装协议不支持覆盖已有的文件时拷贝操作会失败。
Warning
如果目标文件已存在,将会被覆盖。
context
A valid context resource created withstream_context_create().
返回值
成功时返回TRUE, 或者在失败时返回FALSE。
更新日志
版本
说明
案例
Example #1copy()例子
<?php $file = 'example.txt'; $newfile = 'example.txt.bak'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } ?>
参考
- move_uploaded_file()- 将上传的文件移动到新位置
- rename()- 重命名一个文件或目录
- The section of the manual abouthandling file uploads
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。
本文共计425个文字,预计阅读时间需要2分钟。
plaintextcopy - 复制文件copy(string $source, string $dest[, resource $context]): bool将文件从source复制到dest。如果需要移动文件,请使用rename()函数。参数:source - 源文件路径。dest - 目标文件路径。如果dest是字符串php://temp,则不会保存文件。
copy—拷贝文件
说明
copy(string$source,string$dest[,resource$context] ) :bool
将文件从source拷贝到dest。
如果要移动文件的话,请使用rename()函数。
参数
source
源文件路径。
dest
目标路径。如果dest是一个 URL,则如果封装协议不支持覆盖已有的文件时拷贝操作会失败。
Warning
如果目标文件已存在,将会被覆盖。
context
A valid context resource created withstream_context_create().
返回值
成功时返回TRUE, 或者在失败时返回FALSE。
更新日志
版本
说明
案例
Example #1copy()例子
<?php $file = 'example.txt'; $newfile = 'example.txt.bak'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } ?>
参考
- move_uploaded_file()- 将上传的文件移动到新位置
- rename()- 重命名一个文件或目录
- The section of the manual abouthandling file uploads
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。

