PHP code:
$lan = substr(?$HTTP_ACCEPT_LANGUAGE,0,5);
if ($lan == "zh-cn")
print("");
else
print("") ;
?>
HTML web page automatically jumps to multi-language pages according to the language of the browser visiting here
Add the following code between
.
<script> <br>var type=navigator.appName <br>if (type=="Netscape") <br>var lang = navigator.language <br>else <br>var lang = navigator.userLanguage <br>//cut down to first 2 chars of country code <br>var lang = lang.substr(0,2) <br>// English <br>if (lang == "en") <br>window.location.replace('url') <br>// Simplified Chinese <br>else if (lang == " zh-cn") <br>window.location.replace('url') <br>// Traditional Chinese <br>else if (lang == "zh-tw") <br>window.location.replace('url') <br>// German <br> else if (lang == "de") <br>window.location.replace('url') <br>//Except the languages listed above <br>else <br>window.location.replace('url') <br></script>
The above introduces how PHP automatically jumps to Chinese and English pages during automatic jump, including the content of automatic jump. I hope it will be helpful to friends who are interested in PHP tutorials.