请帮忙!我已经尝试解决了一个多小时,我正试图通过POST获取表单值,然后将其放入带有时间戳的txt文件中,我得到的错误是:
警告:file_put_contents(D:\ wamp \ www \ weboldal \ hu \ php \ en \ 03-14-15-11:08:48.txt):无法打开流:D:\ wamp \ www \ weboldal中的参数无效第18行的\ hu \ php \ en \ formprocessing2.php
if ($_POST["type"] == "Type1") {
print "Type1";
$filename = date("m-d-y-h:i:s");
$fullfilename = "D:\\wamp\\www\\weboldal\\hu\\php\\en\\".$filename.".txt";
print $fullfilename;
while (file_exists($fullfilename)) {
print "Please wait a few seconds, server is busy";
sleep(1);
}
$type = $_POST["type"];
$name = $_POST["name"];
$email = $_POST["email"];
$password = $_POST["password"];
$contents = $type."r\n".$name."r\n".$email."r\n".$password;
file_put_contents($fullfilename,$contents,LOCK_EX);
编辑:问题是Windows不能接受文件名中的冒号,这要感谢用户@Hobo Sapiens指出了这一点
Windows会因为冒号而拒绝带有时间戳的文件名。删除那些,你应该没事。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句