php头功能问题

时间:2011-04-24 11:43:13

标签: php

用下面的代码片段,在IE中我找不到服务器错误,但邮件发送工作正常,

邮件发送功能后,浏览器显示无法找到服务器,但如果用F5键刷新,则页面显示正常,

建议,为什么会出现这个错误,

在页面顶部我使用了

<?php session_start();ob_start();ob_end_clean(); ?>

<?php
mail($to, $subject, $message, $headers) or die("mail send failed");

$_SESSION['message'] = "<span class=\"txt-sucess\">Thanks for submitting feedback, We get back you soonly.</span>";                 
header("Cache-control: private, no-cache");
header("Expires: Mon, 26 Jun 1997 05:00:00 GMT");
header("Pragma: no-cache");
header("Location:feedback.php");
?>

2 个答案:

答案 0 :(得分:1)

PHP.net建议您在Header-&gt; Location实例中使用绝对URL。这可能是你需要的。你尝试过不同的浏览器吗?

答案 1 :(得分:1)

尝试以下方法:

<?php

ob_start();
session_start();
ob_end_clean(); // why?!

mail($to, $subject, $message, $headers) or die("mail send failed");

$_SESSION['message'] = "<span class=\"txt-sucess\">Thanks for submitting feedback, We get back you soonly.</span>";                 
header("Cache-control: private, no-cache");
header("Expires: Mon, 26 Jun 1997 05:00:00 GMT");
header("Pragma: no-cache");
header("Location: http://happylife.in/feedback/feedback.php");

?>