[ad_1]
None of the other answers in here actually solved this problem for me.
In this particular case I was using CodeIgniter and adding any of the following lines before the line that caused the error:
$this->load->model('Authnet_Class');
OR
get_instance()->load->model('Authnet_Class')
OR
include APPPATH . '/model/Authnet_Class.php';
Did not solve the problem.
I managed to solve it by invoking the class definition in the construct of the class where I was accessing Authnet_Class
. I.e.:
class MY_Current_Context_Class extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('Authnet_Class');
}
// somewhere below in another function I access Authnet_Class ...
I now understand that the context where you access the Authnet_Class
class, needs to have its definition present on the context’s class construct (and not just before you invoke the properties of Authnet_Class
).
[ad_2]