Codeigniter致命错误:在非对象上调用成员函数getMessage()

时间:2018-12-06 08:10:26

标签: codeigniter paypal codeigniter-3 paypal-rest-sdk

我正在将PayPal库与Codeigniter 3集成在一起。当我第一次尝试它可以正常工作时,我使用了测试付款并给了我成功,但是现在,我尝试立即付款按钮给了我这样的错误:

Fatal error: Call to a member function getMessage() on a non-object in 
C:\OSPanel\domains\localhost\1\public_html\application\libraries\PayPal-PHP- 
SDK\paypal\rest-api-sdk-php\sample\common.php on line 119

这是getMessage()的代码:

public static function printError($title, $objectName, $objectId = null, 
$request = null, $exception = null)
{
    $data = null;
    if ($exception instanceof \PayPal\Exception\PayPalConnectionException) {
        $data = $exception->getData();
    }
    self::printOutput($title, $objectName, $objectId, $request, $data, 
   $exception->getMessage());
}

在这里,当我在Contorller中调用ResultError时:

try {
        $payment->create($this->_api_context);
    } catch (Exception $ex) {
        // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
          ResultPrinter::printError("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", null, $ex);
        exit(1);
    }

我进行了很多搜索,发现他们说有些东西具有空值,而我更改它们仍然没有结果。请帮我解决这个问题。

0 个答案:

没有答案