geoip_netspeedcell_by_name
(PECL geoip >= 1.1.0)
geoip_netspeedcell_by_name — 获取网络连接速度
说明
geoip_netspeedcell_by_name(string
$hostname
): stringgeoip_netspeedcell_by_name() 函数将会返回主机或者 IP 地址对应的网络连接类型和速度。
该函数只有在 GeoIP 1.4.8 版本以上才能使用。
目前,该函数只对购买了商业 GeoIP NetSpeedCell 版本的用户可用,否则将会抛出一个警告!
返回值为字符串,结果集如下:
- Cable/DSL
- Dialup
- Cellular
- Corporate
参数
-
hostname
-
主机名或者 IP 地址。
返回值
成功,返回连接速度,未找到相关信息则返回 false
。
范例
示例 #1 一个 geoip_netspeedcell_by_name() 使用范例:
以下代码将会输出 example.com 主机的连接速度。
<?php
$netspeed = geoip_netspeedcell_by_name('www.example.com');
if ($netspeed) {
echo 'The connection type is: '. $netspeed;
}
?>
以上例程会输出:
The connection type is: Corporate

User Contributed Notes
There are no user contributed notes for this page.
备份地址:http://www.lvesu.com/blog/php/function.geoip-netspeedcell-by-name.php