我上传了一个英语网站(http://calvindeveloping.tk),但我想重定向用户,如果他们是从法国国家到这个网站的路径- http://calvindeveloping.tk/fr/index.php,所以我使用了地理定位插件,插件的工作…除非我尝试在PHP头函数中使用它,像这样-
if ($geoplugin->countryCode == "FR" || $geoplugin->countryCode == "fr") {
header('Location: calvindeveloping.tk/fr/index.php');
}
这是我的英文版本的网站的完整php代码,放置在html代码之前。
$geoplugin = new geoPlugin();
$geoplugin->locate();
$extra = 'fr/index.php';
if ($geoplugin->countryCode == "FR" || $geoplugin->countryCode == "fr") {
header('Location: calvindeveloping.tk/fr/index.php');
exit();
}
?>
请帮助,因为这似乎不工作
删除exit()函数并将您的location函数替换为下面我写的函数
header("Location: http://www.calvindeveloping.tk/fr/index.php");
修改后的代码版本
if ($geoplugin->countryCode == "FR" || $geoplugin->countryCode == "fr") {
header("Location:http://www.calvindeveloping.tk/fr/index.php");
}
你的header代码应该是
header('Location: http://calvindeveloping.tk/fr/index.php');
既然你是