失败以下是在PHP写在一个单独的文件中的一段代码称为core.php中并且这被包括在register.php重定向在PHP
if(($retuserkey = $this->dbcontroller->dbregister($email, $contact)) > 0){
//if user was successfuly registered send an email where he can activate his account!
$this->mailer->sendForReg($email,$hash,$flname);
echo "<script>alert('An activation link is sent to your email id. Please check you spam folder too. Please follow the link to complete the registration.'); window.location = './registersuccess.php';</script>";
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://www.websiteaddress.com/registersuccess.php">';
$url = "http://www.websiteaddress.com/registersuccess.php";
if(!headers_sent()) {
//If headers not sent yet... then do php redirect
header('Location: '.$url);
exit;
} else {
//If headers are sent... do javascript redirect... if javascript disabled, do html redirect.
echo '<script type="text/javascript">';
echo 'window.location.href="'.$url.'";';
echo '</script>';
}
mail("[email protected]","Registration $retuserkey",$email,"Subject");
}
电子邮件之前和之后被发送重定向。这两封电子邮件都被收到,但重定向失败。
我在做什么错?
301重定向失败,如果发送头文件,javascript重定向应该可以工作 – DevZer0