<分区>
这两个函数是否有任何等效的 PHP 函数?我尝试搜索但没有看到任何内容。
谢谢。
标签 php mysql ip-address
<分区>
这两个函数是否有任何等效的 PHP 函数?我尝试搜索但没有看到任何内容。
谢谢。
最佳答案
$ip = '192.0.34.166';
printf("%u\n", ip2long($ip)); // 3221234342
如手册中所述:
Note: Because PHP's integer type is signed, and many IP addresses will result in negative integers, you need to use the "%u" formatter of sprintf() or printf() to get the string representation of the unsigned IP address.
关于INET_NTOA 和 INET_ATON 的 PHP 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1371960/
相关文章:
java - 从封闭字符串中提取 IP 地址和端口的简单 Java 正则表达式
php - Laravel 没有 Eloquent 和数据库迁移?
php - MySQL JOIN -> 从右表中获取所有数据,即使没有匹配项
php - DELETE FROM 不适用于多个表 - 对 mysql 毫 headless 绪
mysql - 如何在 MySQL 中按关联表中的匹配数对行进行排序?
mysql - 远程连接到 Amazon RDS MySql
java - org.postgresql.util.PSQLException : ERROR: invalid input syntax for type inet: