微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHP-表格未显示后的感谢页面

在通过send_mail.PHP发送此邮件后,如何使该页面直接转到该邮件.inc.PHP-文件结构中相同位置的另一个名为ack.PHP的感谢页面

<?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");

您不需要它,因为您不应该返回任何东西

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐