PHP automatically jumps to Chinese and English pages_PHP tutorial

WBOY
Release: 2016-07-21 15:50:28
Original
743 people have browsed it

PHP code:
$lan = substr(?$HTTP_ACCEPT_LANGUAGE,0,5);
if ($lan == "zh-cn")
print("");
else
print("");
?>

HTML web page automatically jumps to the multi-language page according to the language of the browser visited here

in < Add the following code between head> .

<script> <br>var type=navigator.appName <br>if (type=="Netscape") <br>var lang = navigator.language <br>else <br>var lang = navigator.userLanguage <br><br>//cut down to first 2 chars of country code <br>var lang = lang.substr(0,2) <br><br>//English<br>if (lang = = "en") <br>window.location.replace('url') <br><br>// Simplified Chinese<br>else if (lang == "zh-cn") <br>window.location. replace('url') <br><br>// Traditional Chinese<br>else if (lang == "zh-tw") <br>window.location.replace('url') <br><br> // German<br>else if (lang == "de") <br>window.location.replace('url') <br><br>// Except the languages ​​listed above<br>else <br> window.location.replace('url') <br><br></script>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319349.htmlTechArticlePHP code: ? $lan=substr(?$HTTP_ACCEPT_LANGUAGE,0,5); if($lan== "zh-cn") print("metahttp-equiv='refresh'content='0;URL=gb/index.htm'"); else print("metahttp-equiv='refresh'content='0...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template