我正在尝试将 ci-merchant 与贝宝一起使用。
这是我的测试控制器
class Test extends CI_Controller {
function paypal_express(){
$this->load->library('merchant');
$this->merchant->load('paypal_express');
$settings = array(
'username' => '***',
'password' => '***',
'signature' => '***',
'test_mode' => true);
$this->merchant->initialize($settings);
$params = array(
'amount' => 100.00,
'currency' => 'TRY',
'return_url' => site_url('test/paypal_express'),
'cancel_url' => site_url('test/paypal_express'));
$response = $this->merchant->purchase_return($params);
if ($response->success()){
echo 'ok';
}else{
$message = $response->message();
echo('Error processing payment: ' . $message);
exit;
}
}
}
当我运行 site.dev/test/paypal_express 时,我得到了,
致命错误:在第 192 行的 /var/www/ci/application/libraries/merchant.php 中的非对象上调用成员函数 set_params()
php 版本:PHP 5.5.9-1ubuntu4.3 ci 版本:2.2