Home > Backend Development > PHP Tutorial > Verify mobile phone number and location with PHP_PHP Tutorial

Verify mobile phone number and location with PHP_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:32:38
Original
924 people have browsed it

A practical PHP function code, regular expression to verify the correctness of the mobile phone number and query the location of the mobile phone number. Let’s look at the specific code of this function:

view sourceprint?01

 02//Mobile phone number verification

 03function checkMobileValidity($mobilephone){

 04$exp = "/^13[0-9]{1}[0-9]{8}$|15[012356789]{1}[0-9]{8}$|18[012356789] {1}[0-9]{8}$|14[57]{1}[0-9]$/";

 05if(preg_match($exp,$mobilephone)){

 06return true;

 07}else{

 08return false;

 09}

 10}

 11//Mobile phone number location

 12function checkMobilePlace($mobilephone){

 13$url = "http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=".$mobilephone."&t=".time();

 14$content = file_get_contents($url);

 15$p = substr($content, 56, 4);

 16$mo = substr($content, 81, 4);

 17return $str = conv2utf8($p).conv2utf8($mo);

 18}

 19?>

Querying the mobile phone location is to call Taobao’s mobile phone location resources. Please pay attention to the address of this page. If it fails, you can find the correct address on Taobao.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/755622.htmlTechArticleA practical PHP function code, regular expression to verify the correctness of the mobile phone number and query the location of the mobile phone number, below Let’s look at the specific code of this function: view sourceprint?01 02// Hand...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template