New to PHP, oop & codeigniter. My CI version is 3.1.2.
I am trying to load a library that I built, trying to understand Object oriented principles. Probably I'm missing something.
Below is my library.
<?php
class DPS {
private $mode;
public function __construct($params){
//print_r($params);
$this->mode = $params['mode'];
}
public function get_url(){
if($this->$mode == "TEST"){
return "https://uat.paymentexpress.com/pxaccess/pxpay.aspx";
} elseif($this->$mode == "LIVE"){
return "https://sec.paymentexpress.com/pxaccess/pxpay.aspx";
}
}
}
?>
I'm trying to access the get_url method in the controller below.
$params = [ 'mode' => 'TEST'];
$dps = $this->load->library('DPS',$params);
echo $dps->get_url();
Codeigniter is throwing the below error message.
Fatal error: Call to undefined method CI_Loader::get_url()
Being a newbie I'm probably missing some sort of OO fancy thingi. I just can't figure it out. Any help is greatly appreciated.
Thank you in advance