php标头无法重定向


php header cannot redirect

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

'save.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
                      '

Try,

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

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

像这样尝试

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