geoip_netspeedcell_by_name

(PECL geoip >= 1.1.0)

geoip_netspeedcell_by_name獲取網(wǎng)絡(luò)連接速度

說(shuō)明

geoip_netspeedcell_by_name(string $hostname): string

geoip_netspeedcell_by_name() 函數(shù)將會(huì)返回主機(jī)或者 IP 地址對(duì)應(yīng)的網(wǎng)絡(luò)連接類型和速度。

該函數(shù)只有在 GeoIP 1.4.8 版本以上才能使用。

目前,該函數(shù)只對(duì)購(gòu)買了商業(yè) GeoIP NetSpeedCell 版本的用戶可用,否則將會(huì)拋出一個(gè)警告!

返回值為字符串,結(jié)果集如下:

  • Cable/DSL
  • Dialup
  • Cellular
  • Corporate

參數(shù)

hostname

主機(jī)名或者 IP 地址。

返回值

成功,返回連接速度,未找到相關(guān)信息則返回 false 。

范例

示例 #1 一個(gè) geoip_netspeedcell_by_name() 使用范例:

以下代碼將會(huì)輸出 example.com 主機(jī)的連接速度。

<?php
$netspeed 
geoip_netspeedcell_by_name('www.example.com');

if (
$netspeed) {
    echo 
'The connection type is: '$netspeed;
}
?>

以上例程會(huì)輸出:

The connection type is: Corporate