PHP code example of scolib / bankcard
1. Go to this page and download the library: Download scolib/bankcard 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/ */
scolib / bankcard example snippets
php
$bankcard = new Sco\Bankcard\Bankcard();
//$bankcard = new Sco\Bankcard\Bankcard(new Sco\Bankcard\Providers\RegexProvider());
// 返回一个Sco\Bankcard\Info实例
// 如果未识别 抛出异常 Sco\Bankcard\Exceptions\ValidationException
$info = $bankcard->info($cardNo);
// 银行卡信息(数组)
$info->getBankInfo();
// 所属银行代号
$info->getBankCode();
// 所属银行名称
$info->getBankName();
// 所属银行icon(如果有)
$info->getBankIcon();
// 卡类型代号
$info->getCardType();
// 卡类型名称
$info->getCardTypeName();