|
跟着一个教程学习,建立了一个类后,在浏览器下看到这个错误:
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>
|
|