header()根本不做任何事情

时间:2012-04-16 01:52:16

标签: 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"); // this should redirect page

1 个答案:

答案 0 :(得分:0)

尝试此代码应该正常工作

<?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();




?>