Home > Article > Backend Development > National examination common sense judgment php visiting domestic and foreign IP judgment code and realize page jump
I roughly thought about it, and there are two options:
1. Javascript determines the browser language of the visitor. If it is a Chinese system, the users will naturally be Chinese and will jump to the Chinese website;
If it is a non-Chinese system, the default user will be non-Chinese. Chinese people, jump to English websites.
Advantages: Fast judgment and reflection.
Disadvantages: Inaccurate, it is possible that Chinese users prefer to use the English version of the system, or foreigners use the Chinese system.
Code
Copy code The code is as follows:
Copy the code The code is as follows:
$userip=$_SERVER['REMOTE_ADDR'];
// To reference the files of the ip library, place all the files in ip.zip in the lib directory
include_once('/lib/iplimit.class.php');
$iplimit = new iplimit;
if($iplimit->setup( $userip))
{
echo 1;
}
else
{
echo 2;
}
The above introduces the national examination common sense judgment PHP to visit domestic and foreign IP judgment code and realize page jump, including the content of the national examination common sense judgment, I hope it will be helpful to friends who are interested in PHP tutorials.