我试图在标题重定向网址中包含一些GET参数,但无论如何都不会传递到第二页。
代码:
if (isset($_GET['ref'])) {
$ref = $_GET['ref'];
}
if (isset($_GET['placem'])) {
$ad = $_GET['placem'];
}
if (isset($_GET['dse'])) {
$adset = $_GET['dse'];
}
if (isset($_GET['cmp'])) {
$campaign = $_GET['cmp'];
}
if (isset($_GET['aud'])) {
$audience = $_GET['aud'];
}
if (isset($_GET['gen'])) {
$gender = $_GET['gen'];
}
if (isset($_GET['sub1'])) {
$subid1 = $_GET['sub1'];
}
if (isset($_GET['fb_login'])) {
header('Location: /functions/fb_login.php?ref='.urlencode($ref).'&placem='.urlencode($ad).'&dse='.urlencode($adset).'&cmp='
.urlencode($campaign).'&aud='.urlencode($audience).'&gen='.urlencode($gender).'&sub1='.urlencode($subid1) );
}
echo 'Location: /functions/fb_login.php?ref='.urlencode($ref).'&placem='.urlencode($ad).'&dse='.urlencode($adset).'&cmp='
.urlencode($campaign).'&aud='.urlencode($audience).'&gen='.urlencode($gender).'&sub1='.urlencode($subid1);
//echo result : Location: /functions/fb_login.php?ref=test&placem=test&dse=test-Big&cmp=campaign_01&aud=bb.aa.33&gen=m&sub1=111111111111111
// address bar result: /functions/fb_login.php?ref=&placem=&dse=&cmp=&aud=&gen=&sub1=
有人可以指出我在这里做错了什么吗?
答案 0 :(得分:-1)
试试这个..
$var = '';
if (isset($_GET['ref'])) {
$ref = $_GET['ref'];
$var .= "ref='.urlencode($ref).'&";
}
if (isset($_GET['placem'])) {
$ad = $_GET['placem'];
$var .= "placem='.urlencode($ad).'&";
}
if (isset($_GET['dse'])) {
$adset = $_GET['dse'];
$var .= "dse='.urlencode($adset).'&";
}
if (isset($_GET['cmp'])) {
$campaign = $_GET['cmp'];
$var .= "cmp='.urlencode($campaign).'&";
}
if (isset($_GET['aud'])) {
$audience = $_GET['aud'];
$var .= "aud='.urlencode($audience).'&";
}
if (isset($_GET['gen'])) {
$gender = $_GET['gen'];
$var .= "gen='.urlencode($gender).'&";
}
if (isset($_GET['sub1'])) {
$subid1 = $_GET['sub1'];
$var .= "sub1='.urlencode($subid1).'";
}
if (isset($_GET['fb_login'])) {
header('Location: /functions/fb_login.php?'.$var );
}