CI3 Does Not Load the model on the umbler server

Asked

Viewed 901 times

2

I’m running a test on umbler services, but I’m having trouble loading the model. I’m using ci3 and I’m loaded the models as usual.

$this->load->model('main_model');    

But there’s a mistake

An uncaught Exception was encountered
Type: RuntimeException
Message: Unable to locate the model you have specified: Main_model
Filename: /home/bikeradical.com.br/public/system/core/Loader.php
Line Number: 314
Backtrace:
File: /home/bikeradical.com.br/public/index.php
Line: 292
Function: require_once

Saying that it was not found anymore my model is in the right place models/main_model.php, on another server loads, only the one that does not load. Can someone help me.

  • What is your file name and what is the class name?

  • The file name is main_model.php and the class name is class Main_model extends Ci_model

1 answer

2


In codeIgniter 3 the first letter of the class name must be uppercase, the other lowercase and the file name must be equal to the class name, this rule is applied to controllers as well.

Classe    |Arquivo       |
Main_model|Main_model.php|Válido 
User      |user_model.php|inválido

Class Names must have the first Letter capitalized with the Rest of the name lowercase. Make sure your class extends the base Model class.

The file name must match the class name

Documentation CI3 - Model

Documentation CI3 - Controller

Rename the file from main_model.php for Main_model.php.

  • I will do this, to see more then changed in ci3 because in two used this way more strange than in another server is ok and in my local machine also.

  • @Claytoneduardomergulhão yes changed.

  • This is just for model for controller too?

  • 1

    It applies to controllers as well. First uppercase initial, other minuscules and the file must have the same class name. @Claytoneduardomergulhão

  • Thank you for the tip I will perform the tests and if everything gives right warning you, God bless you.

  • 1

    Solved the problem was just that @rray told me that it would be, thank you very much my friend.

Show 1 more comment

Browser other questions tagged

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