Home >php教程 >PHP源码 >12306_网页只允许中国用户访问

12306_网页只允许中国用户访问

PHP中文网
PHP中文网Original
2016-05-25 17:08:091190browse

12306_网页只允许中国用户访问

$language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2);
//获取访客语言,是HTTP头信息的ACCEPT_LANGUAGE的前两个字符
// http://blog.ddian.cn
if($language != 'zh'){
//zh是中文,包括zh-CN简体中文和zh-TW正体中文
header("Location: /yourpage.html");
//这句代码是将用户转向到根目录的yourpage.html这里
exit;
//然后退出
}

2. [代码][PHP]代码

<?php
// http://blog.ddian.cn
$language = substr($_SERVER[&#39;HTTP_ACCEPT_LANGUAGE&#39;],0,2);
if($language == &#39;zh&#39;){
echo &#39;<noscript><noscript>&#39;;
}
?>
</body>

以上就是12306_网页只允许中国用户访问的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Statement:
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
Previous article:多文件上传Next article:php登录函数login session+mysql