-
- error_reporting(E_ALL ^ E_NOTICE);
- // Analyze the attributes of HTTP_ACCEPT_LANGUAGE
- // Only the first language setting is taken here (other functions can be enhanced as needed)
- //Search and organize bbs.it -home.org
- preg_match('/^([a-z-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
- $lang = $matches[1];
- switch ($lang) {
- case 'zh-cn' :
- header('Location: http://cn.jbxue.com/');
- break;
- case 'zh-tw' :
- header('Location: http://tw. jbxue.com/');
- break;
- case 'ko' :
- header('Location: http://ko.jbxue.com/');
- break;
- default:
- header('Location: http:/ /en.jbxue.com/');
- break;
- }
- ?>
Copy code
2, JS-based method:
For those who are interested, test them separately to see which one works better.
|