【发布时间】:2013-11-26 23:50:00
【问题描述】:
我正在尝试将 Omnipay API 与 Pin 网关一起使用,但遇到了问题。
我已经在 composer.json 文件中本地运行了 composer.phar:
{
"require": {
"omnipay/omnipay": "~2.0"
}
}
composer“vendor”文件夹现在位于我网站上的“classes/libs/vendor”中。
我有这个支付类:
class Payment extends BasicClass {
public function charge() {
require "libs/vendor/autoload.php";
use Omnipay\Omnipay;
$gateway = GatewayFactory::create('Pin');
$gateway->setSecretKey($this->config->secretKey);
}
}
调用时:
$topup = new Payment();
$topup->charge();
我收到一个解析错误,PHP 对我的 use Omnipay\Omnipay 行有问题。
非常困惑,因为所有 Omnipay 文档似乎都使用这种语法。
我尝试了类外的 require 和 use 行,但没有帮助。
感谢大家的帮助。
【问题讨论】:
标签: php payment-gateway composer-php omnipay