|  | @@ -750,3 +750,27 @@ if (!function_exists('last_week')) {
 | 
	
		
			
				|  |  |          return $arr;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//ip138接口,ip地址获取实际地址
 | 
	
		
			
				|  |  | +function ip_to_address(){
 | 
	
		
			
				|  |  | +    $ip = request()->ip();
 | 
	
		
			
				|  |  | +    //$ip = '112.6.63.60';
 | 
	
		
			
				|  |  | +    $ipaddress = '火星';
 | 
	
		
			
				|  |  | +    // http协议:http://api.ip138.com/ip/
 | 
	
		
			
				|  |  | +    // https协议:https://api.ip138.com/ip/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    $url = 'http://api.ip138.com/ip/?ip='.$ip.'&datatype=jsonp&token=010e8e53e47166c0623380697e7540e4';
 | 
	
		
			
				|  |  | +    $result = json_decode(curl_get($url),true);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if(is_array($result) && !empty($result)){
 | 
	
		
			
				|  |  | +        if(isset($result['ret']) && $result['ret'] == 'ok'){
 | 
	
		
			
				|  |  | +            if(isset($result['data']) && is_array($result['data']) && !empty($result['data'])){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if(isset($result['data'][2]) && !empty($result['data'][2])){
 | 
	
		
			
				|  |  | +                    $ipaddress = $result['data'][2];
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    return $ipaddress;
 | 
	
		
			
				|  |  | +}
 |