PHP code example of leonis / id-card

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

    

leonis / id-card example snippets


$idCard = new \Leonis\IDCard\IDCard($idCardNumber);

$idCard->check();           // 验证身份号 return bool
$idCard->checkAreaCode();   // 验证行政区划代码 return bool
$idCard->checkBirthday();   // 验证生日 return bool
$idCard->checkCode();       // 验证校验码 return bool
$idCard->address();         // 获取地址 return string
$idCard->province();        // 获取省 return string
$idCard->city();            // 获取市 return string
$idCard->zone();            // 获取区 return string
$idCard->birthday();        // 获取生日 return string
$idCard->year();            // 获取年 return int
$idCard->month();           // 获取月 return int
$idCard->day();             // 获取日 return int
$idCard->age();             // 获取年龄 return int
$idCard->sex();             // 获取性别 return string
$idCard->constellation();   // 获取星座 return string
$idCard->zodiac();          // 获取属相 return string

php vendor/leonis/id-card/data/query.php