missing_GET_variables |有没有办法确定缺失变量的位置或内容

时间:2015-07-18 19:20:37

标签: php forms variables get message

在我的激活码中,它显示了missing_GET_variables,我似乎无法找到丢失的get变量?在我的激活码中它有......

if ( isset($_GET['id']) && isset($_GET['u']) && isset($_GET['e']) && isset($_GET['p']) ) {

然后在底部它有..

} else {
    // Log this issue of missing initial $_GET variables
    header("location: message.php?msg=missing_GET_variables");
    exit(); 
}

有人告诉我要查看我的注册页面,

    $message = '<!DOCTYPE html><html><head><meta charset="UTF-8">
<title>yoursite Message</title>
</head><body style="margin:0px; font-family:Tahoma, Geneva, sans-serif;"><div style="padding:10px; background:#333; font-size:24px; color:#CCC;">
<a href="http://www.yoursite.com">
<img src="http://www.yoursite.com/images/logo.png"; width="36" height="30" alt="yoursite logo" style="border:none; float:left;"></a>yoursite Account Activation</div>
<div style="padding:24px; font-size:17px;">Hello '.$u.',<br />
<br />Click the link below to activate your account when ready:<br /><br />
<a href="http://www.yoursite.com/activation.php?id=&apos;.$uid.'&u='.$u.'&e='.$e.'&p='.$p_hash.'">Click here to activate your account now</a><br />
<br />Login after successful activation using your:<br />* E-mail Address: <b>'.$e.'</b></div></body></html>';

他只给了我一些线索,但显然我似乎无法找到它。我知道人们可能会或可能不会帮助我,那很好。但值得一试,至少要问一下。

2 个答案:

答案 0 :(得分:0)

前进的三种方式:

使用它来查看所有$ _GET:

}else{
    print_r($_GET);
    //header("location: message.php?msg=missing_GET_variables");
    //exit();
}

或者使用它来查看哪一个正在破坏:

}else{
   $id=$_GET['id']
   $u=$_GET['u']
   $e=$_GET['e']
   $p=$_GET['p']
}

或者设置默认值以主动处理该条件(代替整个IF):

$id=(isset($_GET['id'])) ? $_GET['id']: [a good id];
$u=(isset($_GET['u'])) ? $_GET['u']: [a good u];
$e=(isset($_GET['e'])) ? $_GET['e']: [a good e];
$p=(isset($_GET['p'])) ? $_GET['p']: [a good p];

希望这有帮助!

答案 1 :(得分:0)

apos;中有一个' html实体,而不是$message

使用:

$message = '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>yoursite Message</title></head><body style="margin:0px; font-family:Tahoma, Geneva, sans-serif;"><div style="padding:10px; background:#333; font-size:24px; color:#CCC;"><a href="http://www.yoursite.com"><img src="http://www.yoursite.com/images/logo.png"; width="36" height="30" alt="yoursite logo" style="border:none; float:left;"></a>yoursite Account Activation</div><div style="padding:24px; font-size:17px;">Hello '.$u.',<br /><br />Click the link below to activate your account when ready:<br /><br /><a href="http://www.yoursite.com/activation.php?id='.$uid.'&u='.$u.'&e='.$e.'&p='.$p_hash.'">Click here to activate your account now</a><br /><br />Login after successful activation using your:<br />* E-mail Address: <b>'.$e.'</b></div></body></html>';