[英]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.