PHP Class Cml\Vendor\IpLocation

Show file Open project: linhecheng/cmlphp

Public Methods

Method Description
__construct ( string $filename = "UTFWry.dat" ) : IpLocation 构造函数,打开 QQWry.Dat 文件并初始化类中的信息
__destruct ( ) 析构函数,用于在页面执行结束后自动关闭打开的文件。
get_client_ip ( integer $type ) : mixed 获取客户端IP地址
getlocation ( string $ip = '' ) : array 根据所给 IP 地址或域名返回所在地区信息

Private Methods

Method Description
getarea ( ) : string 返回地区信息
getlong ( ) : integer 返回读取的长整型数
getlong3 ( ) : integer 返回读取的3个字节的长整型数
getstring ( string $data = "" ) : string 返回读取的字符串
packip ( string $ip ) : string 返回压缩后可进行比较的IP地址

Method Details

__construct() public method

构造函数,打开 QQWry.Dat 文件并初始化类中的信息
public __construct ( string $filename = "UTFWry.dat" ) : IpLocation
$filename string
return IpLocation

__destruct() public method

析构函数,用于在页面执行结束后自动关闭打开的文件。
public __destruct ( )

get_client_ip() public static method

获取客户端IP地址
public static get_client_ip ( integer $type ) : mixed
$type integer 返回类型 0 返回IP地址 1 返回IPV4地址数字
return mixed

getlocation() public method

根据所给 IP 地址或域名返回所在地区信息
public getlocation ( string $ip = '' ) : array
$ip string
return array