此“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?
答案 0 :(得分: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";