- A+
所属分类:学习总结
外贸网站屏蔽中文操作系统代码(通过判断客户端的操作系统版本)
1.PHP代码如下:
$client_sys_language = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; // system language
if (preg_match (“/^zh-cn/i”,$client_sys_language)) {
echo “<H1>Forbidden</H1>You don’t have permission to access /on this server.<P><P>Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.<HR><ADDRESS>365.dg01.com Port 80</ADDRESS>”;
exit;
}
2.Javascript代码:
<script type=”text/javascript”>
if (navigator.language)
var language = navigator.language;
else
var language = navigator.browserLanguage;
if(language.indexOf(‘zh’) > -1)document.location.href = ‘nddbc.html’;
</script>
1.PHP代码如下:
$client_sys_language = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; // system language
if (preg_match (“/^zh-cn/i”,$client_sys_language)) {
echo “<H1>Forbidden</H1>You don’t have permission to access /on this server.<P><P>Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.<HR><ADDRESS>365.dg01.com Port 80</ADDRESS>”;
exit;
}
2.Javascript代码:
<script type=”text/javascript”>
if (navigator.language)
var language = navigator.language;
else
var language = navigator.browserLanguage;
if(language.indexOf(‘zh’) > -1)document.location.href = ‘nddbc.html’;
</script>
- 我的微信
- 这是我的微信扫一扫
- 我的微信公众号
- 我的微信公众号扫一扫