我正在使用php paysafe SDK(https://github.com/paysafegroup/paysafe_sdk_php)
实施支付系统class_implements():Class 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);
}
答案 0 :(得分: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 repo:https://packagist.org/packages/paysafegroup/paysafe_sdk_php
答案 1 :(得分:0)
class_implements
在5.1.0之前的版本中不可用 - 请验证您的服务器正在运行的PHP版本。