首页 > 解决方案 > 任何人都可以帮助我使用 php-iban 库吗?

问题描述

我在 GitHub 上找到了这个库,我认为它非常适合我的需求。所以我想像这样从 IBAN 获取银行名称和国家名称

<?php
if (isset($_POST["addBtn"])) {
   $ibanNumber = $_POST["IBAN-NUMBER"];
   $country_name = iban_country_get_country_name($ibanNumber);
   $bankName = iban_country_get_central_bank_name($ibanNumber);
   echo $bankName . " " . $country_name;
}
?>

这永远不会返回任何信息或错误。有没有人使用这个库来帮助我?https://github.com/globalcitizen/php-iban

谢谢您的回复

标签: php

解决方案


$country_name = iban_country_get_country_name($ibanNumber);

如果您查看IBAN Country-Level Functions下的示例,您会注意到它们都使用了一个名为 -not 的参数$iban_country$iban就像之前列出的基本 IBAN 验证函数一样。由此,您应该能够推断出,这些方法可能希望仅将 IBAN 作为参数,而是某种 IBAN 国家/地区值/对象。

如果你进一步向下滚动到https://github.com/globalcitizen/php-iban#parsing-functions,你会发现

# Get the country part from an IBAN
$iban_country = iban_get_country_part($iban);

所以你需要先调用它,从你的 IBAN 中提取 IBAN Country - 然后你可以将该 IBAN Country 提供给iban_country_get_country_name.


推荐阅读