在 Codeigniter 1.7.3 中加载模型时出错
您好,感谢您的阅读,
我有一个问题,我有一个控制器“Articles”,应该加载名为“Articles”的模型,唯一的问题是当我尝试加载该模型时出现 500 服务器错误?
有什么建议吗?
预先感谢,
H
Hello and thanks for reading,
I have a problem, I have a controller "Articles" that is supposed to load Model called "Articles", only problem is I get a 500 server error when I try to load that model?
Any suggestions?
Thanks in advance,
H
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案,事实证明,您无法加载与调用它的控制器同名的模型,这确实让 codeigniter 感到困惑。
我的控制器类名称是“Articles”,我的模型名称是“Articles”。当我将模型类名称更改为“Articles_model”时,它工作得很好。我只是想我会分享这个以防其他人也遇到这个问题。
问候,
H
I found the solution, it turns out that you cannot load a Model with the same name as the controller in which it is being called, it really confuses codeigniter.
My controller class name was "Articles" and my model name was "Articles". When I changed the model class name to "Articles_model" instead it worked fine. I just thought I would share this in case any one else has this problem too.
Regards,
H