This action will force synchronization from xluohome/phonedata, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
基于GO语言实现,使用二分查找法。
| 4 bytes | <- phone.dat 版本号(如:1701即17年1月份)
------------
| 4 bytes | <- 第一个索引的偏移
-----------------------
| offset - 8 | <- 记录区
-----------------------
| index | <- 索引区
-----------------------
vi test.go
package main
import (
"fmt"
"github.com/xluohome/phonedata"
)
func main() {
pr, err := phonedata.Find("18957509123")
if err != nil {
panic(err)
}
fmt.Print(pr)
}
go run test.go
PhoneNum: 18957509123
AreaZone: 0575
CardType: 中国电信
City: 绍兴
ZipCode: 312000
Province: 浙江
cmd 目录下phonedata是一个命令行查询手机号归属地信息的终端程序。
Linux:
#PHONE_DATA_DIR=../ ./phonedata 18957509123
Windows:
>set PHONE_DATA_DIR=../
>phonedata.exe 18957509123
stdout:
PhoneNum: 18957509123
AreaZone: 0575
CardType: 中国电信
City: 绍兴
ZipCode: 312000
Province: 浙江
Thinkpad s3 (Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz)
go test -v --bench="."
BenchmarkFindPhone-4 2000000 710 ns/op
好。下载地址 https://git.oschina.net/oss/phonedata/attach_files
python: https://github.com/lovedboy/phone
php : https://github.com/shitoudev/phone-location , https://github.com/iwantofun/php_phone
php ext: https://github.com/jonnywang/phone
java: https://github.com/fengjiajie/phone-number-geo
Node: https://github.com/conzi/phone
C++: https://github.com/yanxijian/phonedata
C##: https://github.com/sndnvaps/Phonedata
手机号归属地信息是通过网上公开数据进行收集整理。
对手机号归属地信息数据的绝对正确,我不做任何保证。因此在生产环境使用前请您自行校对测试。
@lovedboy https://github.com/lovedboy
@zhengji https://github.com/zheng-ji/gophone
欢迎来信交流 phposs@qq.com , QQ群 309020981
Sign in for post a comment
Comments ( 0 )