Php 谢谢,表格后的页面未显示
在通过send_mail.php发送此邮件后,如何让页面直接转到另一个名为tack.php的感谢页面,该页面位于与此mail.inc.php-file相同的结构位置Php 谢谢,表格后的页面未显示,php,email,send,Php,Email,Send,在通过send_mail.php发送此邮件后,如何让页面直接转到另一个名为tack.php的感谢页面,该页面位于与此mail.inc.php-file相同的结构位置 <?php header("Content-Type: text/html; charset=utf8"); function mail_file($to, $from, $subject, $body, $file) { $boundary = md5(rand()); $headers = array(
<?php header("Content-Type: text/html; charset=utf8");
function mail_file($to, $from, $subject, $body, $file) {
$boundary = md5(rand());
$headers = array(
'MIME-Version: 1.0',
"Content-Type: multipart/mixed; charset=UTF-8; boundary=\"{$boundary}\"",
"Content-Transfer-Encoding: 8bit", //Nytt 170711
"From: {$from}"
);
$message = array(
"--{$boundary}",
//'Content-Type: text/HTML; charset=iso-8859-1', 170707
'Content-Transfer-Encoding: quoted-printable',
'',
quoted_printable_encode($body), // Här är nya innehåll kodat som quoted-printable istället.
'', // Kommer orsaka en extra radbrytning efter meddelandet.
"--{$boundary}",
"Content-Type: {$file['type']}; name=\"{$file['name']}\"",
"Content-Disposition: attachment; filename=\"{$file['name']}\"",
"Content-Transfer-Encoding: base64",
'',
chunk_split(base64_encode(file_get_contents($file['tmp_name']))),
"--{$boundary}--",
'',
);
mail($to, $subject, implode("\r\n", $message), implode("\r\n", $headers));
}
?>
在代码末尾添加标题:
header('Location: http://www.example.com/thank_you.php');
它将用户重定向到指定的页面
编辑:
同时删除第一个标题:
php header ("Content-Type: text/html; charset=utf8");
你不需要它,因为你不应该返回任何内容不要发送
内容类型
标题,而是在函数调用后发送重定向
标题。你能告诉我你的意思吗?:)删除您的第一个标题:“php标题(“内容类型:text/html;charset=utf8”);“您不需要它,因为您不应该返回任何内容尝试在调用函数“mail_file”后添加标题,我认为它可以工作!”:)现在只有一个问题。在我的android手机上,我对Gmail的回复带有一个问号符号。Hotmail和webmail都可以。有人吗?是瑞典人…呵呵。我们在这里经常使用它们看看你发现了什么问题吗?如果是的,我很乐意知道。