(PECL geoip >= 1.1.0)
geoip_netspeedcell_by_name — 獲取網(wǎng)絡(luò )連接速度
$hostname
): stringgeoip_netspeedcell_by_name() 函數將會(huì )返回主機或者 IP 地址對應的網(wǎng)絡(luò )連接類(lèi)型和速度。
該函數只有在 GeoIP 1.4.8 版本以上才能使用。
目前,該函數只對購買(mǎi)了商業(yè) GeoIP NetSpeedCell 版本的用戶(hù)可用,否則將會(huì )拋出一個(gè)警告!
返回值為字符串,結果集如下:
hostname
主機名或者 IP 地址。
成功,返回連接速度,未找到相關(guān)信息則返回 false
。
示例 #1 一個(gè) geoip_netspeedcell_by_name() 使用范例:
以下代碼將會(huì )輸出 example.com 主機的連接速度。
<?php
$netspeed = geoip_netspeedcell_by_name('www.example.com');
if ($netspeed) {
echo 'The connection type is: '. $netspeed;
}
?>
以上例程會(huì )輸出:
The connection type is: Corporate