php 手机归属地查询函数详解
本文章来给各位同学介绍一个自己写的php 手机归属地查询函数,原理很简单,实现也不难,相信大家都看的懂。
<?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');
?>文章链接:http://www.phprm.com/code/54452.html
随便收藏,请保留本文地址!