无法在Windows中使用PHP将文件从一个驱动器复制到另一个驱动器

时间:2020-03-18 12:44:17

标签: php windows copy

我试图使用PHP创建文件,并尝试使用以下代码将创建的文件复制到另一个驱动器中

<?php
$file = 'C:\xampp\htdocs\testfile.txt';
$myfile = fopen( $file, "w") or die("Unable to open file!");
$txt = "This is a test";
fwrite($myfile, $txt);
fclose($myfile);
copy($file,'Y:\test.txt');

它不起作用,它显示警告并且没有将创建的文件复制到目的地。

警告:复制(Y:\ test.txt):无法打开流:没有此类文件或 第7行的C:\ xampp \ htdocs \ createfile.php中的目录

是否可以解决此问题?

0 个答案:

没有答案