file_put_contents 和一个新行和 space
file_put_contents and a new line and space
通过电子邮件发送字符串后,我想将其保存到文件中。
所以我这样做:
file_put_contents("coupon.txt", $email. $RandomString , FILE_APPEND | LOCK_EX);
这样它看起来像这样:
email@email.com12d45f8e9email2@email2.com1d2d5s4d51d
所以代码之间没有换行,也没有 space。
当我托盘使用这种方式时:
file_put_contents("coupon.txt", $email. . $RandomString .PHP_EOL. , FILE_APPEND | LOCK_EX);
就是什么都保存不了,还有就是邮件发送出错了。
总计
在你要写的字符串中使用\t和\n。
file_put_contents("coupon.txt", $email."\t". $RandomString . "\n" , FILE_APPEND | LOCK_EX);
您需要附加“\n”,试试这个:
file_put_contents("coupon.txt", $email . " " . $RandomString . "\n" , FILE_APPEND | LOCK_EX);
通过电子邮件发送字符串后,我想将其保存到文件中。 所以我这样做:
file_put_contents("coupon.txt", $email. $RandomString , FILE_APPEND | LOCK_EX);
这样它看起来像这样:
email@email.com12d45f8e9email2@email2.com1d2d5s4d51d
所以代码之间没有换行,也没有 space。 当我托盘使用这种方式时:
file_put_contents("coupon.txt", $email. . $RandomString .PHP_EOL. , FILE_APPEND | LOCK_EX);
就是什么都保存不了,还有就是邮件发送出错了。
总计
在你要写的字符串中使用\t和\n。
file_put_contents("coupon.txt", $email."\t". $RandomString . "\n" , FILE_APPEND | LOCK_EX);
您需要附加“\n”,试试这个:
file_put_contents("coupon.txt", $email . " " . $RandomString . "\n" , FILE_APPEND | LOCK_EX);