|
本帖最后由 Sn.LUF 于 2009-4-15 11:11 编辑
我在照着《PHP 敏捷开发框架 CodeIgniter》的3.7.2中做,代码如下:
<?php
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 are dynamic!";
$this->load->view('testview',$data);
}
}
?>
遇到这样的问题:
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Start::hello(), called in C:\NewDisk\program\xampp\htdocs\WorkSpace\CodeIgniterblog\system\codeigniter\CodeIgniter.php on line 171 and defined
Filename: controllers/start.php
Line Number: 10
welcome to this site
hello,,now we are dynamic!
用site.cn/index.php/start/hello/fred访问时其中的$name名称出不来,还报错,如果给$name赋一个默认值就一直显示默认的名字,fred这个值还是没有成功传递。请问这是怎么回事呢? |
|