我有一个表单,但我希望每个用户只发送一次,所以我想设置一个 cookie 来做到这一点。如何更改我的脚本?
我的 PHP 脚本:
<?php
if (isset($_COOKIE["Form"]) == 1)
{
//Hide form
exit();
}
if ( $_GET['value'] <> "")
{
$adress = 'Receiver@mysite.com';
$subject = 'SUBJECT';
$text = 'TEXT';
mail($adress,
$subject,
$text,
'From: someone@mail.here');
$handle = fopen ( "some-doc.txt", "a" );
fwrite ( $handle, $_GET['value'] );
fclose ( $handle );
echo "Thanks";
setcookie("Form", 1, time()+3600*24*60); // Line 108
exit;
}
?>
错误信息
Warning: Cannot modify header information - headers already sent by (output started at
form.php:6) in
form.php on line 108
我改变了它,但现在我得到了这个错误。