php - 任何人都可以帮助我使用 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
谢谢您的回复
解决方案
$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
.
推荐阅读
- c# - 无法在 Unity、MacOS 中打开 C# 脚本文件
- python - 创建 Pandas 数据框时如何忽略括号内的分隔符?
- c# - C# wpf hittest 对角线
- android - 如何在 Android MotionLayout/MotionScene 中无限运行动画定义?
- ada - 检测行尾的 Ada 程序
- instagram - instagram 帖子的链接响应中始终缺少 Open Graph 元标记
- reactjs - 如何在 Visual Studio 2019 v16.6 子目录下配置 npm 和 package.json?
- docker - 在k8s节点上,如何管理节点上电时的pod磁盘IOland-rush?
- joi - 我可以将枚举用于 JOi 架构属性名称吗
- reactjs - react如何覆盖儿童的道具