-3

这个“formmail.asp” ASP 脚本接收到:

<form action="formmail.asp" method="POST">

阅读表单中的所有字段,构建包含所有字段的消息,然后将此字段和您的值发送到我的电子邮件。

msg = empty

for each field in Request.Form() // read ALL fields in form
    select case lcase(field) // small cap field_name
    case "subject","cco","cc","to","lines","redirect","importance","split","submit","b1","hidden" // ignore some fields
    case else
        msg = msg & (field & " = " & Request.Form(field) & chr(13) & chr(10)) // append a line: field_name = field_value
    end select
next

请问,如何将这部分从 ASP 转换为 PHP?

4

1 回答 1

2
$msg='';
foreach ($_POST as $key=>$val) 
  if (!in_array($key, array("subject","cco","cc","to","lines","redirect","importance","split","submit","b1","hidden"))
    $msg .= "$key = $val\n";
于 2012-05-20T19:59:21.067 回答