首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >class_implements类不存在

class_implements类不存在
EN

Stack Overflow用户
提问于 2017-06-13 16:37:47
回答 2查看 852关注 0票数 2

我正在用paysafe (php)实现一个支付系统。

class_implements():班级退款不存在,也无法加载

我可以创建这样的$r = new Refund()课程退款,但不使用class_implements()

paysafe的开发人员都在windows下,我在ubuntu上,这与class_implements()有什么不同吗?

代码语言:javascript
复制
$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);
    }
EN

回答 2

Stack Overflow用户

发布于 2017-06-20 18:53:52

使用不可加载的类名或非对象调用class_implements将产生警告。

代码语言:javascript
复制
class_implements("Refund"); // class_implements(): Class Refund does not exist and could not be loaded

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

php/blob/master/source/paysafe/CardPayments/Refund.php

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

代码语言:javascript
复制
function __autoload($class_name) {
   require_once $class_name . '.php';
}

我们刚刚发布了标签1.03,它修复了一些自动加载问题,如果您仍然有这个问题。

php/commits/master

您还可以使用Packagist回购:php

票数 2
EN

Stack Overflow用户

发布于 2017-06-13 16:41:56

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44527136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档