php - php 函数给出一个循环 - hostfact API
问题描述
我正在使用 hostfact https://www.hostfact.nl进行计费。现在我想扩展代码并获得一个在 hooks.php 中执行 internalAPI 的循环。我试图在文档https://www.hostfact.nl/developer/api/中找到答案,但没有成功。
// When a client is edited, the bankParameters are checked and validated.
// That is only an example
function action_debtor_is_edited($parameters){
$params = array(
'DebtorCode' => $parameters['DebtorCode']
);
$hostfactResult = internalAPI('debtor', 'show', $params);
$bankParams = array(
'Identifier' => '2',
'AccountNumber' => 'AT6734080000000000',
'AccountBank' => 'test bank',
'AccountCity' => 'city',
'AccountBIC' => 'RLNODASD'
);
$bankResult = internalAPI('debtor', 'edit', $bankParams);
}
我已经询问了支持并得到了以下答案:
一种选择是跟踪情况。例如,使用静态或全局变量。当您从 webhook 调用(内部)API 调用时,首先标记该变量,因此在新调用的 webhook 中,您知道不需要再次执行 webhook(至少不是导致循环的部分)。在原始调用中,收到结果后,可以再次取消设置该标志。
我的问题是,我是 PHP 新手,不明白应该怎么做才能避免循环。$bankParams 变量是故意硬编码的。你能帮我吗?
解决方案
推荐阅读
- sql-server - T-SQL 计算时间窗口中的事件数
- ios - 使用谷歌登录后如何从应用程序委托执行转场
- drupal - 通过用户名以编程方式更改用户密码
- css - 如何停止和项目溢出 CSS 网格列?
- java - 仅从 HttpServletRequest 获取 URI
- sql - 从 PostgreSQL 到 SQL Server 的带布尔值的案例表达式
- mysql - 在 SQL 中将季度日期转换为月末日期
- sql - 查询 Postgresql 数据库以验证单词顺序
- angular - 需要帮助在模态中动态设置消息
- java - 为什么 Android/Java 分析器堆转储显示 5 个单独的对象和大约 7 倍的数组列表开销?