mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-19 14:22:43 +08:00
201 lines
6.7 KiB
HTML
201 lines
6.7 KiB
HTML
<!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>返回 GeoIP 数据库中详细的城市信息</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.geoip-record-by-name" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">geoip_record_by_name</h1>
|
||
<p class="verinfo">(PECL geoip >= 0.2.0)</p><p class="refpurpose"><span class="refname">geoip_record_by_name</span> — <span class="dc-title">返回 GeoIP 数据库中详细的城市信息</span></p>
|
||
|
||
</div>
|
||
<div class="refsect1 description" id="refsect1-function.geoip-record-by-name-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>geoip_record_by_name</strong></span>
|
||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$hostname</code></span>
|
||
) : <span class="type">array</span></div>
|
||
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>geoip_record_by_name()</strong></span> 函数将会返回主机或者 IP 地址所对应的记录信息。
|
||
</p>
|
||
<p class="para">
|
||
该函数在 GeoLite City 版本和商业 GeoIP City 版本中可用。 版本不对的话,将会抛出一个警告。
|
||
</p>
|
||
<p class="para">
|
||
返回的关联数组不同的键名对应如下:
|
||
</p>
|
||
<p class="para">
|
||
<ul class="itemizedlist">
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"continent_code" -- 由两个字符组成的洲简称。(要求 GeoIP 的库版本是1.0.4以上)
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"country_code" -- 由2个字母组成的国家简称。(参见
|
||
<span class="function"><a href="geoip_country_code_by_name.html" class="function">geoip_country_code_by_name()</a></span>)
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"country_code3" -- 由三个字母组成的国家简称。(参见
|
||
<span class="function"><a href="geoip_country_code3_by_name.html" class="function">geoip_country_code3_by_name()</a></span>)
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"country_name" -- 国家名称 (参见
|
||
<span class="function"><a href="geoip_country_name_by_name.html" class="function">geoip_country_name_by_name()</a></span>)
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"region" -- 地区代码 (比如: CA 对应 California)
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"city" -- 城市名称。
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"postal_code" -- 邮编,FSA 或者 Zip 编码。
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"latitude" -- 有符号的双精度纬度。
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"longitude" -- 有符号的双精度经度。
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"dma_code" -- 指定市场区号 (只支持美国和加拿大)
|
||
</span>
|
||
</li>
|
||
<li class="listitem">
|
||
<span class="simpara">
|
||
"area_code" -- PSTN (公共交换电话网络)地区代码。 (比如: 212)
|
||
</span>
|
||
</li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.geoip-record-by-name-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">hostname</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
所要查找的主机或者 IP 地址。
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.geoip-record-by-name-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功,返回关联数组,未找到相关信息则返回 <strong><code>FALSE</code></strong> 。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 changelog" id="refsect1-function.geoip-record-by-name-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>1.0.4</td>
|
||
<td>
|
||
给 GeoIP 1.4.4及以上版本的库添加 continent_code 字段。
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td>1.0.3</td>
|
||
<td>
|
||
添加 country_code3 和 country_name 字段。
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.geoip-record-by-name-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="example-4497">
|
||
<p><strong>Example #1 <span class="function"><strong>geoip_record_by_name()</strong></span> 例子:</strong></p>
|
||
<div class="example-contents"><p>
|
||
以下例程将会输出包含 example.com 主机记录的数组。
|
||
</p></div>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br />$record </span><span style="color: #007700">= </span><span style="color: #0000BB">geoip_record_by_name</span><span style="color: #007700">(</span><span style="color: #DD0000">'www.example.com'</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$record</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$record</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
<div class="example-contents"><p>以上例程会输出:</p></div>
|
||
<div class="example-contents screen">
|
||
<div class="cdata"><pre>
|
||
Array
|
||
(
|
||
[continent_code] => NA
|
||
[country_code] => US
|
||
[country_code3] => USA
|
||
[country_name] => United States
|
||
[region] => CA
|
||
[city] => Marina Del Rey
|
||
[postal_code] =>
|
||
[latitude] => 33.9776992798
|
||
[longitude] => -118.435096741
|
||
[dma_code] => 803
|
||
[area_code] => 310
|
||
)
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |