PHP file_put_contents 无法打开流,参数无效


PHP file_put_contents Failed to open stream, invalid argument

请帮忙!我已经尝试了一个多小时我正在尝试做的是通过 POST 获取表单值,然后将其放入带时间戳的 txt 文件中我得到的错误是:

警告:file_put_contents(D:''wamp''www''weboldal''hu''php''en''03-14-15-11:08:48.txt):无法打开流:第 18 行的 D:''wamp''www''weboldal''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 将拒绝带有时间戳的文件名。删除它们,您应该没事。