inet_pton - 语法

string inet_pton ( string $address )

它用于将人类可读的IP地址转换为in_addr格式

Sr.No 参数 & Description
1

address

它包含IPv4或IPv6地址。

inet_pton - 返回值

它返回in_addr地址,否则将显示失败消息。

inet_pton - 示例

<?php
   $in_addr=inet_pton('127.0.0.1');
?>

上面的代码将IP地址重新转换为in_addr格式的地址。

参考链接

https://www.learnfk.com/php/php-function-inet-pton.html