|
发表于 2013-6-4 18:52:51
|
显示全部楼层
各位 ,我是新手,请教一个问题,今天看到第三章,按照上面的实例,在自己电脑进行操作,结果报错,请大家指教,谢谢,报错信息:
-----------------------------------------------------------------------------------------------------------
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in D:\aptool\web\CodeIgniter\application\controllers\start.php on line 5 ,
------------------------------------------------------------------------------------------------------------
start.php :
----------------------------------------------------------------------------------------------------------->
<?php
class Start extends CI_Controller {
var $base;
var $css;
$this->config->item('name_of_config_variable');
function Start()
{
parent::CI_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('testview', $data);
}
}
------------------------------------------------------------------------------------------------------------------
是不是因为此文档太老,新的CI版本有很大的变更,改如何修改? |
|