PHP中的copy()函数
copy()函数复制文件。创建了源文件到目标文件的副本。如果目标文件已经存在,它将被覆盖。
语法
copy(source_file, dest_file)
参数
source_file-设置要复制的文件
dest_file-设置要复制到的文件
返回
copy()函数返回。
是的,成功了
失败,失败
示例
<?php
echo copy("D:/myfiles/sourcefile.dat","D:/myfiles/destfile.dat");
?>输出结果
true
现在让我们来看另一个例子。
示例
<?php
$file = '/usr/home/guest/example.txt';
$newfile = '/usr/home/guest/example.txt.bak';
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
} else {
echo "copied $file into $newfile\n";
}
?>输出结果
failed to copy /usr/home/guest/example.txt...
热门推荐
1 训练狗狗工作
4 狗狗定点排便训练
5 狗狗训练吠叫
6 狗狗尿垫训练
7 狗狗训练座
8 狗狗训练攻略
9 狗狗训练记
10 做训练狗狗
11 狗狗训练词
12 狗狗谢谢怎么训练
13 狗狗训练如厕
14 狗狗太凶怎么训练
15 狗狗训练它
16 狗狗克制训练
17 训练基地狗狗
18 怎么样训练狗狗大小硬