我加载了我的基于CodeIgniter的网站模型时的错误,但它一直给了一个错误:获取尝试加载模型
"Fatal error: Call to a member function on a non-object in /nfs/c02/h05/mnt/30796/domains/planetchustar.com/html/arguit/system/application/controllers/home.php on line 8"
这里的代码部分的引用:
function index()
{
$this->load->model('posts'); //error here
$result = $this->Posts->get_all_topics();
}
该模型被称为“职位”,其文件名是“posts.php”。
编辑: 我发现我的问题,这是我没有加载到数据库之前,我试图用它的功能之一,所以我固定的,但现在它的说法:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
但我确定我保存在database.php文件中的连接信息是准确的(从phpmyadin网站获得)。
这是否在扩展Controller类的控制器中? – 2009-11-27 22:01:11
是的。我也不想在控制器中制造控制器。 – chustar 2009-11-28 02:28:53
现在完全不同的问题 – ekhaled 2009-11-28 02:41:22