-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 に答える