PHP code example of chendujin / mobile

1. Go to this page and download the library: Download chendujin/mobile library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chendujin / mobile example snippets




public function store(Request $request)
{
    $validator = Validator::make($request->all(), [
        'phone' => ' 'message' => $validator->errors()->first(),
        ]);
    }   

}

$mobile = new \Chendujin\Mobile\Mobile();

// 查询
$mobile->search('15240881243');

// 是否是移动运营商
$mobile->isCMCC('18807397135'); // true

// 是否是联通运营商
$mobile->isCUCC('15507645084'); // true

// 是否是电信运营商
$mobile->isCTCC('18923516448'); // true

// 是否是广电运营商
$mobile->isCBCC('19212071413'); // true

// 是否为手机号码
$mobile->isMobilePhone('18923516448'); // true

// 判断是否为座机号码
$mobile->isTelPhone('5957126'); // true
shell script
$app->register(Chendujin\Mobile\ServiceProvider::class);
bash
php bin/searchMobile 15240881243