奇怪的是,在一个页面上我可以回显由以下构建的变量:
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
$host = $_SERVER['HTTP_HOST'];
$script = $_SERVER['SCRIPT_NAME'];
$params = $_SERVER['QUERY_STRING'];
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;
然后将其发布到另一页(我知道帖子有效,因为我发送了其他值):
<?php echo'<input type="hidden" name="Refferer" value="'.$currentUrl.'"/>'?>
但是当我尝试在我的其他页面上使用它时它现在是空的:
$return = $_Post[Refferer];
header("Location: $return");
任何人都知道发生了什么事吗?
答案 0 :(得分:3)
$ _ POST区分大小写。
尝试使用$ _POST而不是$ _Post。
答案 1 :(得分:2)
尝试:
$return = $_POST['Refferer'];
header("Location: $return");
答案 2 :(得分:1)
尝试:
<?php echo '<input type="hidden" name="Refferer" value="'.urlencode($currentUrl).'"/>' ?>