我有这个代码将用户重定位到index.php,如果他们设置一个dropdownmenu 的值在一个不相关的页面上设置它请检查我的代码。标题位置不在工作服务器上工作,但在本地主机上工作
if(isset($_GET['d'])&&empty($_GET['d'])===false){
$cur_page=$_SERVER['PHP_SELF'];
$current_page = substr($cur_page,1);
$possible_page = array('terms.php','contact.php','about.php');
if(in_array($current_page,$possible_page)){
header('Location:/index.php?d='.$_GET['d'].'');
exit();
}else{
echo $_GET['d'];
}
它在我的本地服务器上正常工作,但在现场服务器上它没有?
您需要更好地解释“不起作用”的含义。你的标题还需要一个空格,例如:''Location:/index.php?d ='' – Sammitch 2013-04-08 16:12:18
如果标题已经发送,header()不起作用。一旦输出到页面,就会发生这种情况,甚至PHP标签之前的空格或字节顺序标记也会发生。 – adeneo 2013-04-08 16:14:12
你刚试过'header('Location:index.php?d ='。$ _ GET ['d'])'? (没有斜线) – jtheman 2013-04-08 16:14:26