I've probably conceived it, and there are two options:
1. JavaScript to determine the browser language of the visitors, if the Chinese system, natural users are Chinese, jump Chinese website;
If the non-Chinese system, the default user is not Chinese, jump English website.
Advantages: The judgment reflects the speed quickly.
Cons: Inaccurate, it is possible that Chinese users prefer to use the English version of the system, or foreigners using the Chinese system situation.
Code
Copy CodeThe code is as follows:
2. Use IP library to make the judgment of visiting IP
Advantages: Accurate judgment.
Cons: The response speed is no JavaScript fast.
Need to reference a PHP IP library ip_php.zip
I'm referring to jquery on the head of the website to judge
Copy CodeThe code is as follows:
...
Code for the checkip.php page:
Copy CodeThe code is as follows:
$userip =$_server[' remote_addr '];
Files referencing IP libraries put all the files in the Ip.zip in the Lib directory
Include_once ('/lib/iplimit.class.php ');
$iplimit = new Iplimit;
if ($iplimit->setup ($userip))
{
Echo 1;
}
Else
{
Echo 2;
}
Both methods can be perfect to determine the visiting IP, choose which depends on your specific needs.
http://www.bkjia.com/PHPjc/320904.html www.bkjia.com true http://www.bkjia.com/PHPjc/320904.html techarticle I probably conceived it, there are two options: 1. JavaScript determines the browser language of the visitor, if it is a Chinese system, the natural user is Chinese, jumping Chinese website;