Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter中缺少PayPal_自适应的参数1_Php_Codeigniter_Paypal - Fatal编程技术网

Php Codeigniter中缺少PayPal_自适应的参数1

Php Codeigniter中缺少PayPal_自适应的参数1,php,codeigniter,paypal,Php,Codeigniter,Paypal,我使用的是Angell EYE PayPal自适应支付代码点火器库。它给了我一个图书馆贝宝的错误 Missing argument 1 for PayPal_Adaptive::__construct() Undefined variable: DataArray 我正在添加配置文件中的所有数据详细信息如下 $config['Sandbox'] = TRUE; $config['APIVersion'] = '123.0'; $config['APIUsern

我使用的是Angell EYE PayPal自适应支付代码点火器库。它给了我一个图书馆贝宝的错误

Missing argument 1 for PayPal_Adaptive::__construct()

Undefined variable: DataArray
我正在添加配置文件中的所有数据详细信息如下

        $config['Sandbox'] = TRUE;
    $config['APIVersion'] = '123.0';
    $config['APIUsername'] = $config['Sandbox'] ? 'paypaltest-facilitator_api1.gmail.com' : 'PRODUCTION_USERNAME_GOES_HERE';
    $config['APIPassword'] = $config['Sandbox'] ? 'JRGZPXDNRRL6LJNQE' : 'PRODUCTION_PASSWORD_GOES_HERE';
    $config['APISignature'] = $config['Sandbox'] ? 'AFcWxV21C7fd0v3bYYYRCpSSRl31A7uQi7GAsii.0uB9g5iAxqvN9Fzm' : 'PRODUCTION_SIGNATURE_GOES_HERE';
    $config['PayFlowUsername'] = $config['Sandbox'] ? 'SANDBOX_USERNAME_GOES_HERE' : 'PRODUCTION_USERNAME_GOGES_HERE';
    $config['PayFlowPassword'] = $config['Sandbox'] ? 'SANDBOX_PASSWORD_GOES_HERE' : 'PRODUCTION_PASSWORD_GOES_HERE';
    $config['PayFlowVendor'] = $config['Sandbox'] ? 'SANDBOX_VENDOR_GOES_HERE' : 'PRODUCTION_VENDOR_GOES_HERE';
    $config['PayFlowPartner'] = $config['Sandbox'] ? 'SANDBOX_PARTNER_GOES_HERE' : 'PRODUCTION_PARTNER_GOES_HERE';

    $config['ApplicationID'] = $config['Sandbox'] ? 'APP-80W284485P519543T' : 'PRODUCTION_APP_ID_GOES_HERE';
    $config['DeveloperEmailAccount'] = 'paypaltest-facilitator@gmail.com';
下面是我的库开始代码,它给出了一个关于DataArray的错误,我不知道这个变量来自哪里,它没有写入任何文件

    class PayPal_Adaptive extends PayPal_Pro
{
    var $DeveloperAccountEmail = '';
    var $XMLNamespace = '';
    var $ApplicationID = '';
    var $IPAddress = '';
    var $DetailLevel = '';
    var $ErrorLanguage = '';

    function __construct($DataArray)
    {
        parent::__construct($DataArray);
        $this->XMLNamespace = 'http://svcs.paypal.com/types/ap';
        $this->IPAddress = isset($DataArray['IPAddress']) ? $DataArray['IPAddress'] : $_SERVER['REMOTE_ADDR'];
        $this->DetailLevel = isset($DataArray['DetailLevel']) ? $DataArray['DetailLevel'] : 'ReturnAll';
        $this->ErrorLanguage = isset($DataArray['ErrorLanguage']) ? $DataArray['ErrorLanguage'] : 'en_US';
        $this->APISubject = isset($DataArray['APISubject']) ? $DataArray['APISubject'] : '';
        $this->DeveloperAccountEmail = isset($DataArray['DeveloperAccountEmail']) ? $DataArray['DeveloperAccountEmail'] : '';
        exit;
我的控制器代码如下

        class Adaptive_payments extends CI_Controller 
    {
        function __construct()
        {
            parent::__construct();

            // Load helpers
            $this->load->helper('url');

            // Load PayPal library
            $this->config->load('paypal');

            $this->load->library('paypal/Paypal_adaptive');
            $this->load->library('paypal/Paypal_payflow');
            $this->load->library('paypal/Paypal_pro');

            $config = array(
                'Sandbox' => $this->config->item('Sandbox'),            // Sandbox / testing mode option.
                'APIUsername' => $this->config->item('APIUsername'),    // PayPal API username of the API caller
                'APIPassword' => $this->config->item('APIPassword'),    // PayPal API password of the API caller
                'APISignature' => $this->config->item('APISignature'),  // PayPal API signature of the API caller
                'APISubject' => '',                                     // PayPal API subject (email address of 3rd party user that has granted API permission for your app)
                'APIVersion' => $this->config->item('APIVersion'),      // API version you'd like to use for your call.  You can set a default version in the class and leave this blank if you want.
                'ApplicationID' => $this->config->item('ApplicationID'), 
                'DeveloperEmailAccount' => $this->config->item('DeveloperEmailAccount')
            );

            if($config['Sandbox'])
            {
                error_reporting(E_ALL);
                ini_set('display_errors', '1'); 
            }

            $this->load->library('paypal/Paypal_adaptive', $config);    
        }


        function index()
        {
            $this->load->view('paypal/samples/adaptive_payments');
        }

告诉我如何解决这个问题…

如前所述,您似乎正在加载所有库,而第二个参数中没有包含$config数组。然后设置$config并再次加载自适应库。删除不带$config的库的加载,它应该适合您。为您的控制器尝试以下操作:

    class Adaptive_payments extends CI_Controller 
{
    function __construct()
    {
        parent::__construct();

        // Load helpers
        $this->load->helper('url');

        // Load PayPal library
        $this->config->load('paypal');

        $config = array(
            'Sandbox' => $this->config->item('Sandbox'),            // Sandbox / testing mode option.
            'APIUsername' => $this->config->item('APIUsername'),    // PayPal API username of the API caller
            'APIPassword' => $this->config->item('APIPassword'),    // PayPal API password of the API caller
            'APISignature' => $this->config->item('APISignature'),  // PayPal API signature of the API caller
            'APISubject' => '',                                     // PayPal API subject (email address of 3rd party user that has granted API permission for your app)
            'APIVersion' => $this->config->item('APIVersion'),      // API version you'd like to use for your call.  You can set a default version in the class and leave this blank if you want.
            'ApplicationID' => $this->config->item('ApplicationID'), 
            'DeveloperEmailAccount' => $this->config->item('DeveloperEmailAccount')
        );

        if($config['Sandbox'])
        {
            error_reporting(E_ALL);
            ini_set('display_errors', '1'); 
        }

        $this->load->library('paypal/Paypal_adaptive', $config);    
    }


    function index()
    {
        $this->load->view('paypal/samples/adaptive_payments');
    }

当库在代码中使用时,向库提供
$DataArray
。我已经这样做了,但不起作用…编辑您的问题并显示控制器代码,说明如何使用库以及如何传递
$DataArray
。问题已更新…您在构造函数中加载库两次。第一次没有参数(发生错误的地方),第二次将一些数组传递给库。你看到了吗?您应该只加载一个库一次。