Reputation:
I was using codeigniter structure like : Filename - User, ControllerClassName - User ModelClassName - User_model
and hitting url : http://localhost/ci/user its showing 404 if I hit http://localhost/ci/User its working fine but unable to locate User_model
and if I use Filename as user,user_model instead of User,User_model it works perfectly
I'm using codeigniter 2
is there any solution for that issue its not working on ubuntu 14.04
Upvotes: 1
Views: 74
Reputation: 38609
load the model in __construct()
function __construct()
{
parent::__construct();
$this->load->model('User_model');
$this->load->library('Session');
}
In Model
File name - user_model.php
Inside File
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class User_model extends CI_Model {
function __construct()
{
parent::__construct();
}
}
In Controller
File name - user.php
Inside File
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class User extends CI_Controller
{
}
Upvotes: 1