Hướng dẫn php ip2long ipv6
1 Show To generate a random IPv4 address that's between a certain range, I do this:
However, Is there anything similar to generate a random IPv6 address that's between a certain range?
asked Jan 24, 2017 at 20:51
AndrewAndrew 5652 gold badges6 silver badges11 bronze badges 1
Add a comment | 1 AnswerSorted by: Reset to default 0 http://php.net/manual/en/function.long2ip.php : "Converts an long integer address into a string in (IPv4) Internet standard dotted format" Read this answer: https://stackoverflow.com/a/35208011/4067232 edited May 23, 2017 at 12:16
CommunityBot 11 silver badge answered Jan 26, 2017 at 12:52
Pedro Amaral CoutoPedro Amaral Couto 1,88512 silver badges14 bronze badges Add a comment | Your AnswerSign up or log inSign up using Google Sign up using Facebook Sign up using Email and Password Post as a guestName Required, but never shown By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy Not the answer you're looking for? Browse other questions tagged phpipipv6 or ask your own question. (adsbygoogle = window.adsbygoogle || []).push({});(PHP 4, PHP 5, PHP 7, PHP 8) ip2long — 将 IPV4 的字符串互联网协议转换成长整型数字 返回值 返回IP地址转换后的数字 或 更新日志
范例示例 #1 ip2long() 例子
示例 #2 显示IP地址 第二个例子说明打印一个转换后的地址使用 printf() 在PHP4和PHP5的功能:
$long == -1 || $long === FALSE) {
注释
参见
joe at joeceresini dot com ¶ 12 years ago
Mike B ¶ 4 years ago
$ip='10.10.10.7'; spinyn at gmail dot com ¶ 13 years ago
php dot net at kenman dot net ¶ 14 years ago
Aleksey Kuznetsov ¶ 10 years ago
ir on ir id is at gm ai ld ot co m ¶ 14 years ago
david dot schueler at tel-billig dot de ¶ 12 years ago
replay111 at tlen dot pl ¶ 10 years ago
$_IP_TYPE_SINGLE = 'single';
Karl Rixon ¶ 7 years ago
chrisp-phpnet at inventivedingo dot com ¶ 14 years ago
jpmarcotte at gmail dot com ¶ 14 years ago
one tiger one at gee mail dot comm ¶ 15 years ago
Ian B ¶ 15 years ago
ken at expitrans dot com ¶ 17 years ago
net_match('192.168.17.1/16', '192.168.15.1')."\n"; // returns true Anonymous ¶ 17 years ago
$ip = new ipv4("192.168.2.1",24); f dot wiessner at smart-weblications dot net ¶ 12 years ago
= "2001:4860:a005::68";
rasmus at mindplay dot dk ¶ 9 years ago
jwadhams1 at yahoo dot com ¶ 13 years ago
oo dot para at gmail dot com ¶ 8 years ago
PandoraBox2007 at gmail dot com ¶ 10 years ago
strlen($int_ip) == 32) {
admin at wudimei dot com ¶ 10 years ago
$ip, $mask) = explode('/', $cidr);$maskBinStr =str_repeat("1", $mask ) . str_repeat("0", 32-$mask ); //net mask binary string alex at alex-at dot ru ¶ 6 years ago
laacz at php dot net ¶ 15 years ago
schat ¶ 3 years ago
|