2

我正在使用 php paysafe SDK ( https://github.com/paysafegroup/paysafe_sdk_php )实现支付系统

class_implements():类退款不存在,无法加载

我能够像这样创建类 Refund$r = new Refund()但不能使用class_implements().

paysafe SDK 的开发人员在 windows 下,我在 ubuntu 上,这会有所不同class_implements()吗?

$refunds = $this->client->cardPaymentService()->getRefunds(new Refund(array('id' => $p->refund_num)));// class exist
$r = new Refund(); // class exist
class_implements("Refund"); // class_implements(): Class Refund does not exist and could not be loaded
$test = new Pagerator($this->client, $refunds , "Refund"); // class_implements(): Class Refund does not exist and could not be loaded

public function __construct(\Paysafe\PaysafeApiClient $client, $data, $className)
    {
        if (!in_array('Paysafe\Pageable', class_implements($className))) {
            throw new PaysafeException("$className does not implement \Paysafe\Pageable");
        }

        $this->client = $client;

        $this->className = $className;
        $this->arrayKey = call_user_func($className . '::getPageableArrayKey');
        $this->position = 0;

        $this->parseResponse($data);
    }
4

2 回答 2

2

使用不可加载的类名或非对象调用 class_implements 会导致警告。

class_implements("Refund"); // class_implements(): Class Refund does not exist and could not be loaded

如果您检查 Paysafe 库并进入对象定义。

https://github.com/paysafegroup/paysafe_sdk_php/blob/master/source/paysafe/CardPayments/Refund.php

您会看到没有自动加载功能。在导入库以支持此功能时,您可能必须自己对其进行硬编码。

function __autoload($class_name) {
   require_once $class_name . '.php';
}

我们刚刚发布的 TAG 1.03 修复了一些自动加载问题,如果您仍然遇到问题。

https://github.com/paysafegroup/paysafe_sdk_php/commits/master

你也可以使用 Packagist 仓库:https ://packagist.org/packages/paysafegroup/paysafe_sdk_php

于 2017-06-20T18:53:52.017 回答
0

class_implements在 5.1.0 之前的版本中不可用 - 请验证您的服务器正在运行哪个版本的 PHP。

于 2017-06-13T16:41:56.490 回答