PHP code example of chrisfoon / identity-card
1. Go to this page and download the library: Download chrisfoon/identity-card 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/ */
chrisfoon / identity-card example snippets
Route::get('test', function(){
$ID = new Douyasi\IdentityCard\ID;
$is_pass = $ID->validateIDCard('42032319930606629x'); //校验身份证证号是否合法
$area = $ID->getArea('42032319930606629x'); //获取身份证所在地信息 遵循GB/T 2260-2007中华人民共和国行政区划代码 标准
$gender = $ID->getGender('42032319930606629x'); //获取性别 'f'表示女,'m'表示男,校验失败返回false
$birthday = $ID->getBirth('42032319930606629x'); //获取出生日期
return compact('is_pass', 'area', 'gender', 'birthday');
});