I am an asp programmer. This is my first time writing a php program. I would like to share my experience
Copy the code The code is as follows:
$ip2id= round(rand(600000, 2550000) / 10000); //The first method is to directly generate
$ip3id= round(rand(600000, 2550000) / 10000);
$ip4id= round(rand(600000, 2550000) / 10000);
//The following is the second method, randomly select from the following data
$arr_1 = array("218","218" ,"66","66","218","218","60","60","202","204","66","66","66","59"," 61","60","222","221","66","59","60","60","66","218","218","62","63" ,"64","66","66","122","211");
$randarr= mt_rand(0,count($arr_1)-1);
$ip1id = $arr_1[ $randarr];
echo $ip1id;
echo ".";
echo $ip2id;
echo ".";
echo $ip3id;
echo ".";
echo $ip4id;
?>
The example output result is 218.28.131.182
The characteristic of this program is that the first field of the generated IP is within the specified range , the set ones are common domestic number ranges, which means that most of the generated IP addresses are domestic
Core code:
Copy code The code is as follows:
$arr_1 = array("http://66.249.89.99","http://66.249.89.104","http://74.125 .71.105");
$randarr= mt_rand(0,count($arr_1)-1);
$gip= $arr_1[$randarr];
echo $gip."$randarr";
?>
http://www.bkjia.com/PHPjc/323196.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323196.htmlTechArticleI am an asp programmer. This is my first time writing a php program. I would like to share my experience. Copy the code as follows: ? php $ip2id= round(rand(600000, 2550000) / 10000); //The first method, directly...