用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1930|回复: 3
收起左侧

[HELP] 新手上路,碰到这样一个问题。

[复制链接]
发表于 2013-6-1 22:48:02 | 显示全部楼层 |阅读模式
跟着一个教程学习,建立了一个类后,在浏览器下看到这个错误:
Fatal error: Class 'Controller' not found in D:\WWW\PHP100\test\application\controllers\start.php on line 8

<?php
/*
* Created on 2013-5-31
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
class Start extends Controller
{
        var $base;
        var $css;
        function Start()
        {
                parent::Controller();
                $this->base = $this->config->item('base_url');
                $this->css = $this->config->item('css');
        }
        function hello($name){
        $data['css'] = $this->css;
        $data['base'] = $this->base;
        $data['mytitle'] = 'welcome to this site';
        $data['mytext'] = "hello, $name, now we're getting dynamic'";
        $this->load->view('my_view',$data);
        }
}

?>
view里面用的代码如下:

<body>

<h1><?php echo $mytitle;?></h1>

<p class = "start"> <?php echo $mytext;?></p>
</body>

发表于 2013-6-2 00:35:23 | 显示全部楼层
{:soso_e127:}好衰,应该写作 CI_Controller吧?
发表于 2013-6-2 22:05:48 | 显示全部楼层
多老的教程......或者是多么不负责任的教程.....
发表于 2013-6-2 22:52:52 | 显示全部楼层
class Start extends Controller应该是 class Start extends CI_Controller

本版积分规则