我一直在尝试在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);
}
}
感谢您的时间,我真的很感激我对错误的看法。
答案 0 :(得分:1)
已加载类,但您需要指出这些类。您正在使用关键字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
。