<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Mymodel extends CI_Model
{
public function myFunction()
{
$data = [
'element1' => 'Test',
'element2' => '123'
];
return $data;
}
}
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Mycontroller extends CI_Controller
{
public function index()
{
$this->load->model('mymodel');
$data = $this->mymodel->myFunction();
$this->load->view('my_view', [
'data' => $data,
]);
}
}