2012-09-12 66 views
-2

我实现了一个简单注册页面,用户已签署了必须将其重定向到感谢页面后,这里是我的代码,它返回一个空白页PHP头不能重定向

' 保存.PHP '

if($mail->Send()) {} 

    unset($_SESSION['GENRE_REQUEST']); 

    } 
    header('Location:thanku.php'); 
     exit(); 
    } 
    else 
     { 
     header('Location:thanku.php'); 
     exit(); 
     } ' 

thanku.php

<tr> 
     <td align="center" valign="top"><b>Thank You for Registering With us.</b> <br /> 
     <br />please activate your profile by clicking on the activation link sent to your email address.<br/> 
     </td> 
    </tr> 'a 
         ' 
+3

打开错误报告。并告诉错误。 – itachi

+0

有两件事:通过在'header()'调用之前放置'die('test')',确保你的'save.php'程序正在执行重定向发生的行。然后,确保你的'thanku.php'页面被调用,清除所有内容并将'test'文本放在里面。这样,你会知道错误发生的地方。 – user1477388

+1

根据你发布的帖子,你有一个'}'在第一行中删除最后一个 – Breezer

回答

0

这将是有助于查看更多的代码。另外,如果你的头文件(“Location:somenewpage.php”)调用失败,PHP应该会发出某种错误。你的php设置中是否打开了display_errors(至少在你的开发环境中)?这将有助于您了解脚本发生了什么问题。

0

尝试这样

if($mail->Send()) { 
    session_destroy(); 
    header('Location:thanku.php'); 
} 
else 
{ 
    header('Location:thanku.php'); 
} 
+0

unset()不会完全破坏会话。 – FirmView

+0

我复制粘贴他的代码我没有看到 并重新形成代码 – AboQutiesh

+0

其他{回声“发送邮件的错误”;} – FirmView

1

尝试,

if($mail->Send()) { 
    header('Location:thanku.php'); 
    exit(); 
}else{ 
    echo "Oops! there was some error in sending the mail"; 
} 

在thanku.php页,

<?php 
    session_start(); 
    session_unset(); 
    session_destroy(); 
    $_SESSION = array(); 

    echo "Thanks message"; 

?>