我正在用paysafe (php)实现一个支付系统。
class_implements():班级退款不存在,也无法加载
我可以创建这样的$r = new Refund()课程退款,但不使用class_implements()。
paysafe的开发人员都在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);
}发布于 2017-06-20 18:53:52
使用不可加载的类名或非对象调用class_implements将产生警告。
class_implements("Refund"); // class_implements(): Class Refund does not exist and could not be loaded如果您检查Paysafe库并进入对象定义。
php/blob/master/source/paysafe/CardPayments/Refund.php
您将看到没有自动加载功能。在导入库以支持此功能时,您可能必须亲自对其进行硬编码。
function __autoload($class_name) {
require_once $class_name . '.php';
}我们刚刚发布了标签1.03,它修复了一些自动加载问题,如果您仍然有这个问题。
您还可以使用Packagist回购:php
发布于 2017-06-13 16:41:56
class_implements在5.1.0之前的版本中不可用--请验证您的服务器正在运行哪个版本的PHP。
https://stackoverflow.com/questions/44527136
复制相似问题