在 Codeigniter 中转换或加载外部文件的最佳方式

Best way to convert or load External files in Code Igniter

我已经开始在 Codeigniter Framework 中集成 Pay U biz 的支付网关。 我从这里下载了 PHP SDK:https://developer.payubiz.in/documentation/Platform-based/29

现在,我测试了它,它在没有框架的情况下工作得很好,但我必须将它与 Code igniter Framework.

集成

我试过这个例子:
注意:payu.php 是从其网站下载的主要文件。

<?php

require_once dirname( __FILE__ ) . '/payu.php';

/* Payments made easy. */

pay_page( array (   'key' => 'gtKFFx', 'txnid' => uniqid( 'animesh_' ), 'amount' => rand( 0, 100 ),
            'firstname' => 'Test', 'email' => 'test@payu.in', 'phone' => '1234567890',
            'productinfo' => 'Product Info', 'surl' => 'payment_success', 'furl' => 'payment_failure'), 'eCwWELxi' );

/* And we are done. */



function payment_success() {
    /* Payment success logic goes here. */
    echo "Payment Success" . "<pre>" . print_r( $_POST, true ) . "</pre>";
}

function payment_failure() {
    /* Payment failure logic goes here. */
    echo "Payment Failure" . "<pre>" . print_r( $_POST, true ) . "</pre>";
}

没有框架也能正常工作。但我想在 codeigniter 中转换它,所以我怎样才能将它转换为 codeigniter。

我尝试制作 payu.php 文件的库。并自动加载该库,但它不起作用,所以我如何在 codeigniter 中转换它?将其转换为 codeigniter 的最佳选择是什么?

So not for only this payment gateway Integration if we want to use another sdk or any thing else like pay u biz. what is the best way to convert or load external files in code igniter Framework.

您可以使用require_once

require_once(APPPATH.'libraries/ion_auth.php');

Codeigniter 有这个指向您的应用程序文件夹的 APPPATH。然后你可以从那里指向任何文件夹。希望这有效

祝你好运