【发布时间】:2021-02-28 08:16:47
【问题描述】:
我想将内容从 (Bazamod.txt) 复制到 (compile.txt) 但出现此错误:
警告:fopen(LicenteSi/Test/compile.txt):无法打开流:否 这样的文件或目录在 /storage/ssd3/361/16261361/public_html/createL.php 在第 137 行
警告:fwrite() 期望参数 1 是资源,布尔值在 /storage/ssd3/361/16261361/public_html/createL.php 在第 141 行
Function create_compile_mod($Licence_Name, $Path){
$FilePath = "$Path/compile.txt";
$myFile = fopen($FilePath, "r+");
copy("bazamod/Bazamod.txt", $FilePath);
fwrite($myFile, $FilePath);
}
谢谢!
【问题讨论】:
-
使用
file_get_contents和file_put_contents函数 -
你是如何调用函数的?您能否将其添加到问题中并可能解释/显示目录结构?
-
bluepinto 帮忙,我成功完成了!非常感谢!
-
使用
file_get_contents和file_put_contents的组合意味着你将所有内容读入内存。适合琐碎的内容,尽管它显然比内部文件系统操作慢得多。但这不会扩展。相反,您应该尝试了解为什么您的copy方法不起作用。并修复它。这很可能是路径问题...
标签: php