Home >Backend Development >PHP Tutorial >Detailed explanation of PHP mobile phone location query function_PHP tutorial

Detailed explanation of PHP mobile phone location query function_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:48:521236browse

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.

if( $handle=@fopen('mob.dat','rb'))
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);
{ @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.dat
http://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...
Statement:
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