This article will introduce to you a PHP mobile phone location query function written by myself. The principle is very simple and the implementation is not difficult. I believe everyone can understand it.
The code is as follows
代码如下 |
复制代码 |
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');
|
|
Copy code
|
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');
Home data file download: mob.dathttp://l4.yunpan.cn/lk/QvYCBFP6TVBjy
http://www.bkjia.com/PHPjc/632764.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632764.htmlTechArticleThis article will introduce to you a self-written PHP mobile phone location query function. The principle is very simple and the implementation is easy. It’s not difficult, I believe everyone can understand it. The code is as follows Copy code function...