我无法得到一个为什么我不能加载这个自己的书面模型到我的控制器。型号代码:模型没有在codeigniter中加载
$this->load->model('storage'); // Line 147
$storageDetails = $storage->getStorageByAccount($userData['accountID']); // Line 148
错误:
class Storage extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
}
function getStorageByID($storageID, $accountID = -1)
{
$query = $this->db->select('*')->from('storage')->where('storageID', $storageID);
if ($accountID != -1)
$query->where('storageAccountID', $accountID);
return $this->finishQuery($query);
}
function getStorageByAccount($accountID)
{
$query = $this->db->select('*')->from('storage')->where('storageAccountID', $accountID)->limit($limit);
return $this->finishQuery($query);
}
function finishQuery($query)
{
$row = $query->get()->result();
return objectToArray($row);
}
}
用于加载和执行控制器中的代码
Message: Undefined variable: storage
Filename: controllers/dashboard.php
Line Number: 148
Fatal error: Call to a member function getStorageByAccount() on a non-object in /home/dev/concept/application/controllers/dashboard.php on line 148
我试图var_dump'ing模型装入命令,但只返回NULL。
在此先感谢。
哦,天哪,你完全正确!我怎么看这个?!感谢您的意见,我先去喝杯咖啡。 –
没问题..很高兴帮助。很容易错过最小的东西:-) –
@MicKri哦,男人,涂料,我完全错过了。 – usumoio