我一整天都在尝试在CodeIgniter中配置Omnipay,我想我终于把它破解了,但是我仍然停留在信用卡验证部分。由于某种原因,当我运行我的程序时,我会得到错误消息Fatal error: Class 'CreditCard' not found in C:\xampp\htdocs\trabajo\emarket\application\controllers\inicio.php on line 37
这是我的控制器:
use Omnipay\Omnipay;
class Inicio extends CI_Controller {
public function index()
{
$gateway = Omnipay::create('PayPal_Pro');
$gateway->setUsername('######');
$gateway->setPassword('######');
$gateway->setSignature('#####');
$gateway->setTestMode(true);
$gateway->initialize();
$cardInput = array(
'firstName' => 'buyer',
'lastName' => 'one million',
'number' => '4032031186341789',
'company' => 'Visa',
'billingAddress1' => 'bill me here',
'billingAddress2' => 'or maybe here',
'billingPhone' => '4085873015',
'billingCity' => 'chicago',
'billingState' => 'illinois',
'billingPostCode' => '646960',
'shippingAddress1' => 'ship it here',
'shippingAddress2' => 'or ship here',
'shippingPhone' => '98789987',
'shippingCity' => 'chicago',
'shippingState' => 'illinois',
'shippingPostCode' => '989898',
);
$card = new CreditCard($cardInput);
}
}谢谢你抽出时间,我非常感谢你给我一些关于我做错了什么的建议。
发布于 2015-05-23 18:50:04
类已加载,但您需要指向这些类。你用关键字use来做这件事。否则,您可以传递如下内容:
$gateway = Omnipay\Omnipay::create('PayPal_Pro');//not quite sure if you need backslash infront of vendor name或者以同样的方式调用CreditCard实例:
$card = new Omnipay\Common\CreditCard($cardInput);这就是关键字use的原因。
这是一个很好的主题来源。。
https://stackoverflow.com/questions/30407423
复制相似问题