Php codeigniter自定义库未定义属性错误
我为我的支付网关创建了一个codeigniter自定义库(My_payment_gate_way_init)。。但当我使用自定义库函数时,控制器(计费)不会将参数传递到它显示的库中Php codeigniter自定义库未定义属性错误,php,codeigniter,Php,Codeigniter,我为我的支付网关创建了一个codeigniter自定义库(My_payment_gate_way_init)。。但当我使用自定义库函数时,控制器(计费)不会将参数传递到它显示的库中 A PHP Error was encountered Severity: Notice Message: Undefined property: Billing::$My_payment_gate_way_init Filename: controllers/Billing.php Line Number:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Billing::$My_payment_gate_way_init
Filename: controllers/Billing.php
Line Number: 576
当我使用
控制器
public function __construct()
{
parent::__construct();
$this->load->library('My_payment_gate_way_init');
}
function saveord(){
$ammount = $this->totlCost * 100;
$this->My_payment_gate_way_init->setTransactionAmountforPay($ammount);
}
库
class My_payment_gate_way_init
{
private $clientConfig;
private $initRequest;
private $transactionAmount;
private $redirect;
private $initResponse;
private $client;
private $CI;
function __construct()
{
$this->setTransactionAmountforPay();
}
function setTransactionAmountforPay($ammount=200){
// sets transaction-amounts details (all amounts are in cents)
$this->transactionAmount = new TransactionAmount();
$this->transactionAmount->setTotalAmount(0);
$this->transactionAmount->setServiceFeeAmount(0);
$this->transactionAmount->setPaymentAmount($ammount);
$this->transactionAmount->setCurrency("LKR");
$this->initRequest->setTransactionAmount($this->transactionAmount);
}
它还在底部显示了这个错误
致命错误:调用上的成员函数SetTransactionMountForPay()
无效
C:\xampp\htdocs\debug\u online\application\controllers\Billing.php on
第576行
在调用函数之前先创建一个对象
$this->My_payment_gate_way_init = new My_payment_gate_way_init();
$this->My_payment_gate_way_init->setTransactionAmountforPay($ammount);
在调用函数之前先创建一个对象
$this->My_payment_gate_way_init = new My_payment_gate_way_init();
$this->My_payment_gate_way_init->setTransactionAmountforPay($ammount);
对唐克斯兄弟。你救了我的命是的。。。唐克斯兄弟。你救了我的命。