PHP code example of ijoywan / citizenid

1. Go to this page and download the library: Download ijoywan/citizenid 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/ */

    

ijoywan / citizenid example snippets


use ijoywan\citizenid;
    
$parser = new Parser();
$parser->setId($id);
    
//身份证号码格式是否正确
$parser->isValidate();
    
//获取生日,格式YYYYmmdd
$parser->getBirthday();
    
//获取性别, 1-男, 0-女,对应的常量为Parser::GENDER_MALE, Parser::FEMALE
$parser->getGender()
    
//获取行政区域,返回数组包含省,市,县,完整区域
$parser->getRegion();