我有一个问题..PHP重定向没有发生
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL.'?app_not_found';
}
通过功能我获取当前的URL .... 现在我有两个条件
if($databaseAppVersion == $appVersionName)
{
//echo curPageURL();
header('Location: '.curPageURL());
}
else
{
$url ="www.google.com";
//echo $url;
header('Location: '.$url);
}
当我打印他们的回声正在发生,但问题是,它不会将我重定向到预定页面... 在第一个条件我想重定向到当前页面有消息 ie localhost/test/index.php? app_not_found 但这是不会发生
只是一个小题目,但对于https,您的代码将追加:443因为您只查找隐式端口80 – JoSSte
您看过错误日志吗?是否有任何代码在调用header('location')之前发送任何内容? – JoSSte
nopes ....你看过我的代码 –