【发布时间】:2016-01-30 19:48:44
【问题描述】:
我有一个问题。我做了一个小项目,希望像其他文本粘贴保存软件一样。这是主要的小代码:
fopen("text/$file.txt", "w+");
fwrite($file, $data);
fclose("text/$file.txt");
}
else {
die('No post data to process');
}
?>
问题是它给了我这些错误:
Warning: fwrite() expects parameter 1 to be resource, integer given in /home/u257807476/public_html/ready.php on line 8
Warning: fclose() expects parameter 1 to be resource, string given in /home/u257807476/public_html/ready.php on line 10
我不知道为什么。请帮帮我!
【问题讨论】:
-
我必须指定 PHP 创建我的文件,但它什么都不包含。
-
如果您想在文件中写入所有帖子参数,请告诉我
-
有什么方法可以使用 .txt 文件中断显示在 php 中吗?我做了一个示例,通过用户输入创建随机 .txt 文件,输出显示在一行中,我正在使用 file_get_contents 或导入来显示它。我正在使用 w+ 打开文件。
标签: javascript php html random syntax-error