讀取身份證資訊 php 讀取身份證資訊

2021-10-11 14:36:58 字數 3646 閱讀 3429

<?php

namespace

;class

identitycardservice

/**獲取位址**/

public

function

get_addr

($id

)/**根據身份證號,自動返回對應的星座

* @param $cid

* @return string

*/public

function

getstarsign

($cid

)elseif(

($month==2

&&$day

>20)

||($month==3

&&$day

<=20)

)elseif(

($month==3

&&$day

>20)

||($month==4

&&$day

<=20)

)elseif(

($month==4

&&$day

>20)

||($month==5

&&$day

<=21)

)elseif(

($month==5

&&$day

>21)

||($month==6

&&$day

<=21)

)elseif(

($month==6

&&$day

>21)

||($month==7

&&$day

<=22)

)elseif(

($month==7

&&$day

>22)

||($month==8

&&$day

<=23)

)elseif(

($month==8

&&$day

>23)

||($month==9

&&$day

<=23)

)elseif(

($month==9

&&$day

>23)

||($month

==10

&&$day

<=23)

)elseif(

($month

==10

&&$day

>23)

||($month

==11

&&$day

<=22)

)elseif(

($month

==11

&&$day

>22)

||($month

==12

&&$day

<=21)

)elseif(

($month

==12

&&$day

>21)

||($month==1

&&$day

<=20)

)return

$strvalue;}

/**根據身份證號,自動返回對應的生肖

* @param $cid

* @return string

*/public

function

getanimalsign

($cid)if

($x==0

)if($x

==11

||$x==-

1)if(

$x==

10||

$x==-2

)if($x

==9||$x==-

3)if(

$x==8||

$x==-4

)if($x

==7||$x==-

5)if(

$x==6||

$x==-6

)if($x

==5||$x==-

7)if(

$x==4||

$x==-8

)if($x

==3||$x==-

9)if(

$x==2||

$x==-10

)return

$value;}

/***根據身份證號,自動返回性別

* @param $cid

* @return string

*/public

function

get***sign

($cid

)/***檢查是否是身份證號

* @param $number

* @return bool

*/public

function

isidcard

($number);

//提取相應的加權因子$w=

$wi[$i]

;//把從身份證號碼中提取的一位數字和加權因子相乘,並累加

$sigma+=

$b*$w;

}//計算序號

$snumber

=$sigma%11

;//按照序號從校驗碼串中提取相應的字元。

$check_number

=$ai

[$snumber];

if($number

==$check_number

)else

}/***獲取生日的時間戳

* @param $idcard

* @return int

*/public

function

getbirthday

($idcard

)elseif

($tmonth

<0||

$tmonth

>12)

elseif

($tday

<0||

$tday

>31)

else

else}}

elseif

(strlen

($idcard)==

15)elseif

($tmonth

<0||

$tmonth

>12)

elseif

($tday

<0||

$tday

>31)

else

else}}

$result

['error']=

2;//0:未知錯誤,1:身份證格式錯誤,2:無錯誤

$result

['isadult']=

$flag

;//0標示成年,1標示未成年

$result

['birthday']=

$tdate

;//生日日期

return

strtotime

($tdate);

//返回生日的時間戳

}/**據生日時間戳 獲得年齡

* @param $birthday

* @return bool|int|string

*/function

getage

($birthday

)return

$age;}

}

QT讀取身份證資訊

ifndef bp readcard h define bp readcard h include include include typedef int stdcall cvr initcomm int 初始化 typedef int stdcall cvr authenticate 卡認證 ty...

VUE實現華視身份證閱讀器讀取身份證資訊

這是模板 直接放在之間就可以。title visible.sync open width 10 class mb8 1.5 type success icon el icon plus size mini click connect 連線 el button el col 1.5 type warn...

PHP驗證身份證

原作者有個錯的地方改了轉過來 document 檢查符合 gb11643 1999 標準的身份證號碼的正確性 file gb11643 1999.func.php fri mar 28 09 42 41 cst 2008 zxing updated fri mar 28 09 42 41 cst 2...