相关疑难解决方法(0)

您如何根据号码检测信用卡类型?

我试图弄清楚如何根据其数量来检测信用卡的类型.有谁知道一个明确,可靠的方法来找到这个?

language-agnostic algorithm e-commerce

504
推荐指数
14
解决办法
44万
查看次数

格式化信用卡号

如何在键入时格式化并验证每个4位数之间带有空格的信用卡号:

eg: 4464 6846 4354 3564
Run Code Online (Sandbox Code Playgroud)

我试过了:

$('.creditno').keyup(function() {
    cc = $(this).val().split("-").join("");

    cc = cc.match(new RegExp('.{1,4}$|.{1,4}', 'g')).join("-");

    $(this).val(cc);

});
Run Code Online (Sandbox Code Playgroud)

请帮忙

html javascript php

11
推荐指数
5
解决办法
2万
查看次数

在codeigniter中验证信用卡的最佳方法是什么?

嗨,我正在使用codeigniter.我想验证我的信用卡详细信息.我看到php中有类来验证信用卡号码.我在codeigniter看到了一个帮助器来验证信用卡

http://codeigniter.com/wiki/Credit_Card_Helper

/**
 * Truncates a card number retaining only the first 4 and the last 4 digits.  It then returns the truncated form.
 *
 * @param string The card number to truncate.
 * @return string The truncated card number.
 */
function truncate_card($card_num) {
    $padsize = (strlen($card_num) < 7 ? 0 : strlen($card_num) - 7);
    return substr($card_num, 0, 4) . str_repeat('X', $padsize). substr($card_num, -3);
}


/**
 * Validates a card expiry date.  Finds the midnight on first day of the …
Run Code Online (Sandbox Code Playgroud)

php codeigniter credit-card

2
推荐指数
1
解决办法
3026
查看次数