略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: geoip_netspeedcell_by_name

2024-04-30

geoip_netspeedcell_by_name

(PECL geoip >= 1.1.0)

geoip_netspeedcell_by_name获取网络连接速度

说明

geoip_netspeedcell_by_name(string $hostname): string

geoip_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
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.geoip-netspeedcell-by-name.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3