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 the Code code 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 the Code code as follows:
Copy the Code code 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.
The above introduces the national test Common sense PHP to visit domestic and foreign IP Judgment Code and to achieve page jump, including the national test of common sense of the content, I hope that the PHP tutorial interested friends have helped.