3', PHPWEB:'php.cn', settings:'settings', FullScreen:'Full Screen', Speed:'Speed', BrainwashingLoop:'Loop', speedNormal:'Normal', click_to_see:'Click to see full code for direct edit', nextSection:'Next Section', Cancel:'Cancel', Confirm:'Confirm', all_lang_string:'zh|en|zh-tw|ja|ko|ms|fr|de', Next:'Next', Previous:'Previous', };
Home > php教程 > php手册 > php自动跳转中英文页面

php自动跳转中英文页面

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:27:34
Original
789 people have browsed it

PHP代码:

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

HTML网页根据来访这的浏览器语言不同自动跳转多语言页面

在 

  之间加入如下代码。

<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>// 英语 <BR>if (lang == "en") <BR>window.location.replace('url') <br><br>// 简体中文 <BR>else if (lang == "zh-cn") <BR>window.location.replace('url') <br><br>// 繁体中文 <BR>else if (lang == "zh-tw") <BR>window.location.replace('url') <br><br>// 德语 <BR>else if (lang == "de") <BR>window.location.replace('url') <br><br>// 除上面所列的语言 <BR>else <BR>window.location.replace('url') <br><br></script>
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template