Troubleshooting codeigniter “Unable to locate the model you have specified…” error

帅比萌擦擦* 提交于 2019-12-13 04:54:15

问题


I have been developing a web application using CodeIgniter on my Mac with no issues whatsoever. I am using the Ion Auth library for user authentication. I have no ported the site the production server and I am getting the following error:

An Error Was Encountered

Unable to locate the model you have specified: Ion_auth_model

All of the posts on here seem to be file placement or the case of the filename or class name. I have quadruple checked the ion auth model code..

/application/models/ion_auth_model.php

class Ion_auth_model extends CI_Model{
   ...
}

The only place the model is loaded is in the ion auth library:

/applicaiton/libraries/ion_auth.php

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

And most frustratingly - it works perfectly on my development system. The only differences between my prod and dev environments is the database config (I even have it in development mode now so I might seen an error.

No log entry, no helpful error on the page, no help at all from CodeIgniter to direct me where the error is coming from.

Can anyone point me in the right direction to troubleshoot this????


回答1:


As said in the comments : Your model's filename must start with an uppercase. In your case, Ion_auth_model.php.

See https://codeigniter.com/userguide3/changelog.html#version-3-0-0

changed filenaming convention (class file names now must be Ucfirst and everything else in lowercase).




回答2:


your autoload configuration ( application/config/autoload.php )

$autoload['libraries'] = array('ion_auth');

it worked for me, please try it...



来源:https://stackoverflow.com/questions/28506163/troubleshooting-codeigniter-unable-to-locate-the-model-you-have-specified-e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!