We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
已经是最新版本的yar了
#======php -v PHP 7.0.17 (cli) (built: Jul 4 2017 13:47:27) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.17, Copyright (c) 1999-2017, by Zend Technologies #======php --ri yar
yar
yar support => enabled Version => 2.0.3
Directive => Local Value => Master Value yar.packager => msgpack => msgpack yar.transport => curl => curl yar.debug => Off => Off yar.expose_info => On => On yar.connect_timeout => 5000 => 5000 yar.timeout => 60000 => 60000 yar.content_type => application/octet-stream => application/octet-stream yar.allow_persistent => 1 => 1
代码: try { $yar = new Yar_Client(YAR_GEO_LOCATION); $yar->setOpt(YAR_OPT_PERSISTENT, 1); switch ($type) { case 'ip2location': if (!empty($ip)) { $data = $yar->ip2location($ip); } break; case 'gps2location': if (!empty($lon) && !empty($lat)) { $data = $yar->gps2location((float) $lat, (float) $lon); } break; } } catch (Exception $e) { writeLog('type:' . $type . ',lon:' . $lon . ',lat:' . $lat . ',ip:' . $ip . ',msg:' . $e->getMessage(), 'yarGeoLocationError'); }
偶发性异常: 2017-08-16 18:38:37||type:ip2location,lon:,lat:,ip:112.80.1.218,msg:empty response
The text was updated successfully, but these errors were encountered:
empty respone也有可能是服务端crash了, 或者提前关闭了链接, 还是要具体分析下服务端的实现
Sorry, something went wrong.
No branches or pull requests
已经是最新版本的yar了
#======php -v
PHP 7.0.17 (cli) (built: Jul 4 2017 13:47:27) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.17, Copyright (c) 1999-2017, by Zend Technologies
#======php --ri yar
yar
yar support => enabled
Version => 2.0.3
Directive => Local Value => Master Value
yar.packager => msgpack => msgpack
yar.transport => curl => curl
yar.debug => Off => Off
yar.expose_info => On => On
yar.connect_timeout => 5000 => 5000
yar.timeout => 60000 => 60000
yar.content_type => application/octet-stream => application/octet-stream
yar.allow_persistent => 1 => 1
代码:
try {
$yar = new Yar_Client(YAR_GEO_LOCATION);
$yar->setOpt(YAR_OPT_PERSISTENT, 1);
switch ($type) {
case 'ip2location':
if (!empty($ip)) {
$data = $yar->ip2location($ip);
}
break;
case 'gps2location':
if (!empty($lon) && !empty($lat)) {
$data = $yar->gps2location((float) $lat, (float) $lon);
}
break;
}
} catch (Exception $e) {
writeLog('type:' . $type . ',lon:' . $lon . ',lat:' . $lat . ',ip:' . $ip . ',msg:' . $e->getMessage(), 'yarGeoLocationError');
}
偶发性异常:
2017-08-16 18:38:37||type:ip2location,lon:,lat:,ip:112.80.1.218,msg:empty response
The text was updated successfully, but these errors were encountered: