亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP ?? ?? ????: ?? ???

1. PHP ??? ??

PHP ??? ????? ?? ???? ????

?? ?? ??? ??? PHP ??:

<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>

<?php
if (isset($_REQUEST['email'])) { // 如果接收到郵箱參數(shù)則發(fā)送郵件
	// 發(fā)送郵件
	$email = $_REQUEST['email'] ;
	$subject = $_REQUEST['subject'] ;
	$message = $_REQUEST['message'] ;
	mail("someone@example.com", $subject,
	$message, "From:" . $email);
	echo "郵件發(fā)送成功";
} else { // 如果沒(méi)有郵箱參數(shù)則顯示表單
	echo "<form method='post' action='mailform.php'>
	Email: <input name='email' type='text'><br>
	Subject: <input name='subject' type='text'><br>
	Message:<br>
	<textarea name='message' rows='15' cols='40'>
	</textarea><br>
	<input type='submit'>
	</form>";
}
?>
</body>
</html>

? ??? ???? ???? ?? ???? ?? ??? ?? ??? ??? ???? ??? ? ??? ????.

???? ??? ??? ???? ?? ???? ???? ??? ????

someone@example.com%0ACc:person2@example.com

%0ABcc:person3@example.com,person3@example.com,

anotherperson4@example. com,person5@example.com

%0ABTo:person6@example.com

??? ????? mail() ??? ?? ???? ??? ??? ???? ?? ???? ?? ??? ????. ??:, ?? ??: ? ?? ??: ??? ???????. ???? ?? ??? ???? ? ???? ?? ?? ??? ?????!


2. PHP ??? ???

??? ???? ???? ?? ?? ??? ?? ??? ???? ????. (?? ??? ??? ??)

?? ??? ?? ?? ??? ????? ???? ??? ??? ??? ???? ?? ??? ???? ??????:

<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
<?php
function spamcheck($field)
{
// filter_var() 過(guò)濾 e-mail
// 使用 FILTER_SANITIZE_EMAIL
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
 
//filter_var() 過(guò)濾 e-mail
// 使用 FILTER_VALIDATE_EMAIL
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
return TRUE;
}
else
{
return FALSE;
}
}
 
if (isset($_REQUEST['email']))
{
// 如果接收到郵箱參數(shù)則發(fā)送郵件
 
// 判斷郵箱是否合法
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "非法輸入";
}
else
{
// 發(fā)送郵件
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("someone@example.com", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
}
else
{
// 如果沒(méi)有郵箱參數(shù)則顯示表單
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text'><br>
Subject: <input name='subject' type='text'><br>
Message:<br>
<textarea name='message' rows='15' cols='40'>
</textarea><br>
<input type='submit'>
</form>";
}
?>
 
</body>
</html>

??: ? ????? PHP ??? ???? ??? ??????.

  • FILTER_SANITIZE_EMAIL ??? ????? ???? ?????. ??? ??

  • FILTER_VALIDATE_EMAIL ??? ??? ?? ?? ???? ?????.

??? ?? ??? ??? PHP?? ??? ? ????. ??.


???? ??
||
<html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <?php if (isset($_REQUEST['email'])) { // 如果接收到郵箱參數(shù)則發(fā)送郵件 // 發(fā)送郵件 $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("someone@example.com", $subject, $message, "From:" . $email); echo "郵件發(fā)送成功"; } else { // 如果沒(méi)有郵箱參數(shù)則顯示表單 echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text'><br> Subject: <input name='subject' type='text'><br> Message:<br> <textarea name='message' rows='15' cols='40'> </textarea><br> <input type='submit'> </form>"; } ?> </body> </html>