示例#1
0
/**
 * Created by PhpStorm.
 * User: wangxiaofeng
 * Date: 8/30/15
 * Time: 2:24 PM
 */
function validation_filter_id_card($id_card)
{
    if (strlen($id_card) == 18) {
        return idcard_checksum18($id_card);
    } elseif (strlen($id_card) == 15) {
        $id_card = idcard_15to18($id_card);
        return idcard_checksum18($id_card);
    } else {
        return false;
    }
}
示例#2
0
function input_identity_number($id_card, $msg)
{
    if (strlen($id_card) == 15) {
        return idcard_15to18($id_card);
    }
    if (idcard_checksum18($id_card)) {
        return $id_card;
    }
    response_msg($msg);
}
示例#3
0
/**
 *身份证号码检查接口函数
 *@params string $idcard 身份证号码
 *@return bool 是否正确
 */
function check_identity_num($identity_num)
{
    if (strlen($identity_num) == 15 || strlen($identity_num) == 18) {
        if (strlen($identity_num) == 15) {
            $identity_num = idcard_15to18($identity_num);
        }
        if (idcard_checksum18($identity_num)) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}