Beispiel #1
0
 /**
  * 获取真实HTTP客户端IP,按次序尝试
  *
  * @return string
  */
 public static function getClientIP()
 {
     if (strlen(self::$client_ip) < 7) {
         self::$client_ip = IP::getClientIP();
     }
     return self::$client_ip;
 }
Beispiel #2
0
 public static function insteadOfURL(&$url)
 {
     $hostname = parse_url($url, PHP_URL_HOST);
     if ($ipaddr = IP::getHostIP($hostname)) {
         $url = str_ireplace($hostname, $ipaddr, $url);
     }
     return $hostname;
 }
Beispiel #3
0
 /**
  * 将IP对象或字符串ip转为HEX格式
  */
 public static function formatIP($ipaddr)
 {
     return IP::toHex($ipaddr);
 }
Beispiel #4
0
<?php

use Cute\Utility\IP;
use Cute\Network\JobServer;
app()->route('/', function () {
    $job_server = JobServer::getInstance();
    $job_server->setWorkerFile(APP_ROOT . '/workers/geo_worker.php');
    var_dump($job_server->reverse('Hello World'));
    var_dump($job_server->reverse('Hello', 'World'));
    $ipaddr = IP::getServerIP();
    var_dump($ipaddr);
    var_dump($job_server->ip_search_country($ipaddr));
    var_dump($job_server->ip_search_address($ipaddr));
    var_dump($job_server->phone_search_city('0035818', '028', '18475870001'));
});
Beispiel #5
0
 public static function getClientIP()
 {
     return IP::getClientIP();
 }