The model name you are loading is the name of a re

2019-08-12 07:15发布

When I load my base_model normally, it's ok. But when I use autoload.php to load base_model, I get a problem:

The model name you are loading is the name of a resource that is already being used: base_model

Please help me solve this!:)

3条回答
戒情不戒烟
2楼-- · 2019-08-12 07:33

I know this is old post... If you put parent::__construct in any controller function (except constructor) you get this message.

查看更多
神经病院院长
3楼-- · 2019-08-12 07:36

Once you autoload the model in autoload.php, again you try to load the same file some or the another controller or model, this will show following error.

The model name you are loading is the name of a resource that is already being used: base_model

to avoid that i will just recommend that do not load that model anywhere in the full application once you autoload that particular model.

查看更多
家丑人穷心不美
4楼-- · 2019-08-12 07:36

For the sake of completeness I want to refer to this blog post (in german) that suggests loading the models without a name.

1 // yes :-)
2 $this->load->model('stream_model');
3 $this->stream_model->foo();

instead of

1 // NO!
2 $this->load->model('stream_model', 'stream');
3 $this->stream->foo();

It helped me because I didn't have an auto loader configured and the model wansn't loaded inside the controller (or its super classes).

查看更多
登录 后发表回答