【问题标题】:How to use the Whmcs getproducts function in Laravel如何在 Laravel 中使用 Whmcs getproducts 函数
【发布时间】:2019-11-01 09:07:45
【问题描述】:

我有一个使用 Whmcs 集成的 Laravel 项目。这就是 whmcs 的使用方式:

Whmcs::getproducts([
            'pid' => 1,
        ]);

在哪里可以找到getproducts 函数?搜索了函数名,包里没找到。

【问题讨论】:

  • 您能告诉我们您使用的库吗?

标签: php laravel whmcs


【解决方案1】:

没有这样的方法。 WhmcsManager 类有一个正在使用的魔术方法 __call。任何不可访问或不存在的方法调用将由__call 处理,它将方法名称和参数传递给execute 方法,该方法将使用action 参数设置为您调用的方法名称进行API 调用。

WhmcsManager@__call

WhmcsManager@execute

PHP Manual - Classes and Objects - Method Overloading - __call

【讨论】:

    【解决方案2】:

    我假设你正在使用这个包

    https://github.com/darthsoup/laravel-whmcs

    它只是用于 WHMCS API 的包装。

    GetProducts的API参考

    https://developers.whmcs.com/api-reference/getproducts/

    所以,据我了解,您只需用驼峰式大小写设置正确的名称

    Whmcs::GetProducts([
        'pid' => 1,
    ])
    

    或者没有魔法方法:

    $whmcs = app('whmcs');
    $whmcs->execute('GetProducts', [
        'pid' => 1,
    ]);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-07
      • 2017-03-30
      • 1970-01-01
      • 2014-12-27
      • 1970-01-01
      • 1970-01-01
      • 2018-07-08
      • 2015-03-08
      相关资源
      最近更新 更多