Model does not load Codeigniter

Asked

Viewed 73 times

0

I am trying to make a Model work, it works on MAC with MAMP PRO, but in Ubuntu with Apache2 it does not work.

models/users_model.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

Class Users_model extends CI_Model {

    function __construct() {
        parent::__construct();
    }

controllers/verifylogin.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class VerifyLogin extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->model('users_model', '', TRUE);
    }

By logging in to cms.local/admin/login it redirects to admin/verifylogin

On this screen he fires that error:

An Error Was Encountered

Unable to locate the model you have specified: Users_model

Codeigniter 3

  • The other models carry right?

  • 1

    Solved, in Codeigniter 3 the files have to be in "capitalize" mode, e.g.: Verifylogin.php, models/Users_model.php

  • @rray no model carried, because it was lowercase the files.

  • 1

    Put this as an answer, if you find the link to the documentation that says this is better.

  • Yes, I could even post the answer, but the error is not in Codeigniter, yes in Ubuntu, because on Mac with MAMP Pro works. How strange.

  • But the class name is not different from the file? documentation link

  • No, it wasn’t, but on the Mac I used to _model quiet, just models/users.php and the class as Users in verifylogin.php, I will report this bug, I will also compare the PHP versions of the two.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.