Home > php教程 > php手册 > php 手机归属地查询函数详解

php 手机归属地查询函数详解

WBOY
Release: 2016-06-13 09:50:59
Original
1321 people have browsed it

本文章来给各位同学介绍一个自己写的php 手机归属地查询函数,原理很简单,实现也不难,相信大家都看的懂。

 代码如下 复制代码


function get_area($mob){
$mob=substr($mob,0,7);
if(
$handle=@fopen('mob.dat','rb'))
{
@flock($handle,LOCK_SH);
$string=@fread($handle,@filesize('mob.dat'));
@fclose($handle);
}
$string=strstr($string,$mob);
$num=strpos($string,"n");
$end=substr($string,0,$num);
list($a,$area)=explode(",",$end);
return $area;
} //demo

echo get_area('13000000000');


归属地数据文件下载:mob.dat

http://l4.yunpan.cn/lk/QvYCBFP6TVBjy

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template