PHP code example of ouhaohan8023 / id-info
1. Go to this page and download the library: Download ouhaohan8023/id-info 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/ */
ouhaohan8023 / id-info example snippets
// 获取身份证信息
$id = '132235196706122646';
$m = IDInfoFacade::info($id);
dd($m);
dd($m->getProvince());
Ouhaohan8023\IDInfo\Model\IDInfoModel {
+"province_code": 130000
+"city_code": 132200
+"area_code": 132235
+"province": "xx省"
+"city": "xx市"
+"area": "xx县"
+"age": 18
+"sex": "男"
+"zodiac": "猴"
}
// 检查18位身份证是否合法
$str = "141031199604270069";
$d = IDInfoFacade::check18($str); // bool
dd($d);
php artisan vendor:publish --provider="Ouhaohan8023\IDInfo\IDInfoServiceProvider"
迁移 php artisan migrate
初始化 php artisan id-info:init