簡體   English   中英

如何將Omnipay加載到Codeigniter項目

[英]How to load Omnipay to Codeigniter project

我已經嘗試添加require_once 'vendor/autoload.php'; 在根文件夾中的index.php上,但是沒有用,我遇到Fatal error: Class 'Omnipay' not found 還添加use Omnipay\\Omnipay; 導致此錯誤:

A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT'

Filename: Common/AbstractGateway.php

Line Number: 208

我已經使用作曲家安裝omnipay插件。 我不確定如何在codeigniter控制器中正確加載omn​​ipay

Omnipay已加載並且工作正常。

消息:使用不確定的常量CURLOPT_CONNECTTIMEOUT-假定為'CURLOPT_CONNECTTIMEOUT'

您沒有在服務器上啟用curl curl擴展。 要求您的主機啟用它。

然后將API文件夾放在/ application / third_party文件夾中,然后在/ application / library文件夾中創建名為Omnipay_call.php或根據您的要求的codeigniter

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
require_once(APPPATH. 'third_party/Omnipay/vendor/autoload.php');

class Omnipay_call extends Omnipay {

     /**
     *
     * @param type $rules 
     */
    public function __construct($rules = array()) {
        list($use, $key,......,$__n) = array();
        $gateway = Omnipay::create($use);
        $gateway->setApiKey($key);
    }

}

在控制器中

$this->load->library("omnipay_call", $params = array());

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM