【发布时间】:2011-01-14 00:39:23
【问题描述】:
登录后我想将用户发送回$value,
$value 是用我的代码生成的,打印出来的,看起来还不错。
这是一个完整的网址:http://example.com/page.php?id=6,
但它忽略了header("Location: ".$value); 声明:
if($iniciando->iniciar()) {
if (isset($_SESSION['redirect'])) {
$he ="http://funcook.com" . $_SESSION['redirect'];
mostrar_notificacion($he);
header("Status: 301");
header("Location: " . $he, true, 301);
} else {
imprimir_sesion_iniciada();
}
} else {
imprimir_formulario_sesion();
}
【问题讨论】:
-
可能显示完整代码。之后你会
die()吗? -
您在此代码之前是否打印过任何内容?尝试退出();在 header() 之后
-
dieafterheader不需要重定向工作。打开错误,你可能会得到一个标题已经发送警告,正如马特建议的那样。 -
如果可能,尝试使用 'curl --head yoursite.com' 或使用 LiveHTTPHeaders(Firefox 的插件)。它们在调试时非常有用,它们会在标题中显示重定向。
-
你能解释一下如何尝试 curl 选项吗?