公司业务需要根据银行卡号查询银行卡的相关信息,如归属地,归属银行,卡的种类等,下面是个人的总结查询方式如下:
header('Content-type:text/html;charset=utf-8'); require_once('bankList.php'); function bankInfo($card,$bankList) { $card_8 = substr($card, 0, 8); if (isset($bankList[$card_8])) { echo $bankList[$card_8]; return; } $card_6 = substr($card, 0, 6); if (isset($bankList[$card_6])) { echo $bankList[$card_6]; return; } $card_5 = substr($card, 0, 5); if (isset($bankList[$card_5])) { echo $bankList[$card_5]; return; } $card_4 = substr($card, 0, 4); if (isset($bankList[$card_4])) { echo $bankList[$card_4]; return; } echo '该卡号信息暂无'; } bankInfo('6212260200012699399',$bankList);
文件bankList.php中包含的银行前几位对应的银行账号所属的卡名称,下面是部分信息,如下:
... '620025' => '中国银行(澳大利亚)-预付卡-预付费卡', '620026' => '中国银行(澳大利亚)-预付卡-预付费卡', '621293' => '中国银行(澳大利亚)-借记卡-借记卡', '621294' => '中国银行(澳大利亚)-借记卡-借记卡', '621342' => '中国银行(澳大利亚)-借记卡-借记卡', '621343' => '中国银行(澳大利亚)-借记卡-借记卡', '621364' => '中国银行(澳大利亚)-借记卡-借记卡', '621394' => '中国银行(澳大利亚)-借记卡-借记卡', '621648' => '中国银行金边分行-借记卡-借记卡', '621248' => '中国银行雅加达分行-借记卡-借记卡', '621215' => '中银东京分行-借记卡普卡-借记卡', '621249' => '中国银行首尔分行-借记卡-借记卡', '622750' => '中国银行澳门分行-人民币信用卡-贷记卡', '622751' => '中国银行澳门分行-人民币信用卡-贷记卡', ...