首页 文章

在Code Igniter中转换或加载外部文件的最佳方法

提问于
浏览
1

我已经开始在Codeigniter框架中支付网关集成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的最佳选择是什么?

因此,如果我们想要使用其他sdk或其他任何东西,例如pay u biz,那么不仅仅是这个支付网关集成 . 在代码点火器框架中转换或加载外部文件的最佳方法是什么 .

1 回答

  • 1

    您可以使用require_once

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

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

    Goodluck meyt

相关问题