[英]Unable to locate the model you have specified: modelName
我正在尝试加载此模型:
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;
}
}
这是我的控制器所在的位置:
function hello($name)
{
$this->load->model('Menu');
$mymenu = $this->Menu->show_menu();
}
为什么我会收到此错误?
Unable to locate the model you have specified: menu
CodeIgniter无法找到模型的文件。 如果您将模型命名为Menu
,请确保文件名为menu.php
而不是menu_model.php
。
确保型号名称为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;
}
}
但加载类是“菜单”而不是“菜单”
function hello($name)
{
$this->load->model('menu');
$mymenu = $this->menu->show_menu();
}
希望这很有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.