PHP Verification Mobile Phone number (support attribution query and encoded as UTF8) _php tutorial

Source: Internet
Author: User
Copy CodeThe code is as follows:
Mobile phone number Verification
function Checkmobilevalidity ($mobilephone) {
$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]$/";
if (Preg_match ($exp, $mobilephone)) {
return true;
return false;
Cell phone number Attribution (back to: Guangdong Mobile)
function Checkmobileplace ($mobilephone) {
$url = "". $mobilephone. " &t= ". Time ();
$content = file_get_contents ($url);
$p = substr ($content, 56, 4);
$mo = substr ($content, 81, 4);
return $str = Conv2utf8 ($p). Conv2utf8 ($MO);
Convert string encoding to UTF8
function Conv2utf8 ($text) {
Return mb_convert_encoding ($text, ' UTF-8 ', ' ascii,gb2312,gb18030,gbk,utf-8 ');
} true techarticle Copy the code as follows:? PHP//Mobile number verification function checkmobilevalidity ($mobilephone) {$exp = "/^13[0-9]{1}[0-9]{8}$|15[012356789]{1} [0-9] {8}$|18[012356789]{1}[0-9]{8}$|14[ ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.