Php header()什么也不做

Php header()什么也不做,php,Php,最近我唯一改变的是将register_globals关闭 以下是登录脚本的结尾: $from = $_POST['from']; //convert form element to var //echo "got here, from is $from"; die; // test to prove $from is empty if($from == '') { $from = '/pages/reg2.html'; } header("Location: $from"); /

最近我唯一改变的是将register_globals关闭

以下是登录脚本的结尾:

$from = $_POST['from']; //convert form element to var
//echo "got here, from is $from"; die; 

// test to prove $from is empty
if($from == '')
{ 
    $from = '/pages/reg2.html'; 
}
header("Location: $from"); // this should redirect page

试试看,这段代码应该行得通

<?php

if (isset($_POST['from']) && !empty($_POST['from'])) { 
$from = $_POST['from']; //convert form element to var
//echo "got here, from is $from"; die; 

 // test to prove $from is empty
}

if(empty($from))

{ 
    $from = '/pages/reg2.html'; 
}

//if still doesnt work try to replace this line with : echo $from; exit(); 
//just for you to know at what point you are .
header("Location: $from");
exit();




?>

与标题问题无关,但使用empty代替==ie,如果empty$from看起来脚本中有一些调试输出。你知道实际上正在调用header吗?@jasonbar不知道,页面只是停留在它所在的位置。我在哪里可以看到错误日志?@Darren:你的代码中两个正斜杠之间真的有空格吗?