Copy code The code is as follows:
$lan = $_SERVER['HTTP_ACCEPT_LANGUAGE']; //Get Browser language version
if (preg_match("/[zh]{2}-[hk]{2}/", $lan) || preg_match("/[zh]{2}-[tw]{2 }/", $lan)) {//Taiwan and Hong Kong go to the traditional Chinese page
$url = 'hk/index.php';
header("location: " . $url);
} elseif (preg_match("/(?i)^[en]/", $lan)) { //English countries go to the English page
$url = 'en/index.php';
header("location : " . $url);
} elseif (preg_match("/[zh]{2}-[cn]{2}/", $lan)) { //Go to the simplified Chinese page in mainland China
$ url = 'cn/index.php';
header("location: " . $url);
} else { //Others go to English or other pages
$url = 'en/index. php';
header("location: " . $url);
}
?>
http://www.bkjia.com/PHPjc/328090.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328090.htmlTechArticleCopy the code as follows: ?php $lan = $_SERVER['HTTP_ACCEPT_LANGUAGE']; //Get the browser language Version if (preg_match("/[zh]{2}-[hk]{2}/", $lan) || preg_match("/[zh]{2}-[tw]{2}/"...