【INET_NTOA和INET_ATON的PHP Equivalant】教程文章相关的互联网学习教程文章

不明白php中的inet_pton的返回值是什么?该怎么解决

不明白php中的inet_pton的返回值是什么?我看到文档说inet_pton的功能是:Converts a human readable IP address to its packed in_addr representation返回值是:Returns the in_addr representation of the given address。packed in_addr representation是什么?我怎么去除返回值或显示返回值呢?为什么我echo,print_r出来的内容全是乱码呢。var_dump出来的是string(16) " #1;#2; @"string(16) " #1;#2; ?"string(16) " #1;#2;0...

INET_NTOA和INET_ATON的PHP Equivalant【代码】

参见英文答案 > INET_ATON() and INET_NTOA() in PHP? 6个这两个函数有没有PHP等价物?我试过搜索但看不到任何东西. 谢谢.解决方法:你想要ip2long()和long2ip().$ip = '192.0.34.166'; printf("%u\n", ip2long($ip)); // 3221234342如手册中所述:Note: Because PHP’s integer type issigned, and many IP addresses willresult in negative integers, you needto use the “%u” formatter o...