uTools-Manuals/docs/php/inet_pton.html
2019-04-28 19:00:34 +08:00

122 lines
4.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Converts a human readable IP address to its packed in_addr representation</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.inet-pton" class="refentry">
<div class="refnamediv">
<h1 class="refname">inet_pton</h1>
<p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7)</p><p class="refpurpose"><span class="refname">inet_pton</span> &mdash; <span class="dc-title">Converts a human readable IP address to its packed in_addr representation</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.inet-pton-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>inet_pton</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$address</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
This function converts a human readable IPv4 or IPv6 address (if PHP
was built with IPv6 support enabled) into an address family appropriate
32bit or 128bit binary structure.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.inet-pton-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">address</code></dt>
<dd>
<p class="para">
A human readable IPv4 or IPv6 address.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.inet-pton-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns the <em>in_addr</em> representation of the given
<code class="parameter">address</code>, or <strong><code>FALSE</code></strong> if a syntactically invalid
<code class="parameter">address</code> is given (for example, an IPv4 address
without dots or an IPv6 address without colons).
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.inet-pton-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-5500">
<p><strong>Example #1 <span class="function"><strong>inet_pton()</strong></span> Example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$in_addr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">inet_pton</span><span style="color: #007700">(</span><span style="color: #DD0000">'127.0.0.1'</span><span style="color: #007700">);<br />&nbsp;<br /></span><span style="color: #0000BB">$in6_addr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">inet_pton</span><span style="color: #007700">(</span><span style="color: #DD0000">'::1'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.inet-pton-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>5.3.0</td>
<td>
This function is now available on Windows platforms.
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.inet-pton-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="ip2long.html" class="function" rel="rdfs-seeAlso">ip2long()</a> - 将 IPV4 的字符串互联网协议转换成长整型数字</span></li>
<li class="member"><span class="function"><a href="long2ip.html" class="function" rel="rdfs-seeAlso">long2ip()</a> - 将长整型转化为字符串形式带点的互联网标准格式地址IPV4</span></li>
<li class="member"><span class="function"><a href="inet_ntop.html" class="function" rel="rdfs-seeAlso">inet_ntop()</a> - Converts a packed internet address to a human readable representation</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>