[英]Unable to locate the model you have specified: modelName
I am trying to load this model: 我正在尝试加载此模型:
class Menu {
function show_menu()
{
$obj =& get_instance();
$obj->load->helper('url');
$menu = anchor("start/hello/fred","Say hello to Fred |");
$menu .= anchor("start/hello/bert","Say hello to Bert |");
$menu .= anchor("start/another_function","Do something else |");
return $menu;
}
}
This is where my controller is: 这是我的控制器所在的位置:
function hello($name)
{
$this->load->model('Menu');
$mymenu = $this->Menu->show_menu();
}
Why do I get this error? 为什么我会收到此错误?
Unable to locate the model you have specified: menu
CodeIgniter can't find the file of the model. CodeIgniter无法找到模型的文件。 If you named your model
Menu
, make sure the file name is menu.php
and not something else like menu_model.php
. 如果您将模型命名为
Menu
,请确保文件名为menu.php
而不是menu_model.php
。
Ensure that the the model name is Menu and the class name is also Menu 确保型号名称为Menu,类名称也为Menu
class Menu extends CI_Model{
function show_menu()
{
$obj =& get_instance();
$obj->load->helper('url');
$menu = anchor("start/hello/fred","Say hello to Fred |");
$menu .= anchor("start/hello/bert","Say hello to Bert |");
$menu .= anchor("start/another_function","Do something else |");
return $menu;
}
}
but loading the class is 'menu' NOT 'Menu' 但加载类是“菜单”而不是“菜单”
function hello($name)
{
$this->load->model('menu');
$mymenu = $this->menu->show_menu();
}
hope this was helpful 希望这很有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.