<?php// vars from the form$form_name = $_POST["form_name"];
$form_email = $_POST["form_email"];
$form_body = $_POST["form_body"];
$form_admin_email = $_POST["form_admin_email"];
if (!isset( $form_name,
$form_email,
$form_body,
$form_admin_email )) { exit("operationResult=KO");}
$admin_message_object = "Message from website by $form_name";
$admin_headers = "From: Message from website by $form_name <$form_email>";
$admin_message = "
Data from website:Name:
$form_nameEmail:
$form_emailMessage:
$form_body
";
$user_message_object = "Thank you for contacting us";
$user_headers = "From: Company Name <$form_admin_email>";
$user_message = "Thank you for contacting us.
Your message and contact information here.
";
if ( mail($form_admin_email, $admin_message_object, $admin_message, $admin_headers) &&
mail($form_email, $user_message_object, $user_message, $user_headers)) { exit("operationResult=OK");}?>
本人不懂php请各位帮帮忙,解释下这段代码是做什么用的?谢谢

解决方案 »

  1.   

    这里全部是php语言部分吗?没有直接显示的内容吗?
      

  2.   


    是php语言, 如果不出错就不直接显示内容
      

  3.   

    operationResult=KO或operationResult=OK
    这是返回显示的部分
    发邮件要什么显示的内容你把邮件的内容通过form提交给这一页.用这一页来处理.把邮件发给去.返回给你处理的结果
    如果你提交的内容不正确返回operationResult=KO.如果发给用户的邮件正确且给管理员"抄送"正确返回operationResult=OK
      

  4.   

    接收参数
    判断变量
    组合email内容
    mail发email
      

  5.   

    恩 能看出来是和mail相关的