-2, 'msg' => '身份证最后一位输入错误')); exit; } } else { if ($idCardLast == $idCardY[$idCardMod]) { $flag = true; } else { echo json_encode(array('code' => -2, 'msg' => '身份证信息不正确')); exit; } } } else if (strlen($idCard) == 15) { $id17 = substr($idCard, 0, 6) . '19' . substr($idCard, 6); $parityBit = getParityBit($id17); $tempIdCard = $id17 . $parityBit; $flag = validateIdCard($tempIdCard); } } else { echo json_encode(array('code' => -2, 'msg' => '身份证号码有误,请重新输入')); exit; } return $flag; }