2016-05-02 66 views
1

查看:vw_home.phpPHP - 找不到对象

<?php echo "hello world "; ?> 

控制器:home.php

<?php 
      defined('BASEPATH') OR exit('No direct script access allowed'); 
      class home extends CI_Controller{ 
       function __construct(){ 
        parent::__construct(); 
        } 
       function index(){ 
        $data['page_title']="WELCOME | CSB SDP"; 
        $this->load->view('SideBar',$data);  
       } 
      } 
    } 

路线:

<?php 
     defined('BASEPATH') OR exit('No direct script access allowed'); 
      $route['default_controller'] = 'home/index'; 
?> 

_I猜测这个模型在这里不适用;我是Codeigniter的新手,结果发现有错误

OBJECT NOT FOUND。

任何人都可以请帮我:(还有什么在这里没有?

+0

错误指向的代码行是什么? – splash58

+0

请发布完整的错误日志详细信息。 –

+0

类和文件名的首字母只能是大写。在Ci3版本中。正如这里解释http://www.codeigniter.com/user_guide/general/controllers.html#let-s-try-it-hello-world – user4419336

回答

1

您需要的文件和类名首都首字母你home.php应该Home.php

class home extends CI_Controller{ 

class Home extends CI_Controller{ 
+0

_thanks :),现在我知道 –

0

更改$route['default_controller']

$route['default_controller']='home\index'

$route['default_controller']='home'

,因为它是寻找home文件夹内的CONTROLER index

+0

_thanks :)我会考虑这个答案 –

+0

接受此作为答案,如果这将满足您的问题的解决方案 –