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

M问题

[复制链接]
发表于 2008-7-26 12:40:04 | 显示全部楼层 |阅读模式
控制器文件welcome.php
PHP复制代码
class Welcome extends Controller {
 
    Public $domain;
    function Welcome()
    {
        parent::Controller();
        $this->domain    = (substr($_SERVER['HTTP_HOST'], 0, 4)=="www.")?str_replace("www.", "", $_SERVER['HTTP_HOST']):$_SERVER['HTTP_HOST'];    
        echo $this->domain;
    }
   
    function index($domain)
    {
        $this->load->model('get_info');
        $info    =    $this->get_info->get_infos($domain);
 
        //$this->load->view('welcome_message');
    }
}
复制代码


模型文件:Get_info.php
PHP复制代码
class Get_info extends Model
{
    function Get_info()
        {
            parent::Model();    
        }
 
    function get_infos($domain)
        {    
            echo $domain;
            $query = $this->db->get('whyparking_domains');
            //return $query->result();
        }
}
复制代码


为什么总是错误:
PHP复制代码
 
localhost
A PHP Error was encountered
 
Severity: Warning
 
Message: Missing argument 1 for Welcome::index()
 
Filename: controllers/welcome.php
 
Line Number: 13
A PHP Error was encountered
 
Severity: Notice
 
Message: Undefined variable: domain
 
Filename: controllers/welcome.php
 
Line Number: 16
A PHP Error was encountered
 
Severity: Notice
 
Message: Undefined property: Get_info::$db
 
Filename: models/Get_info.php
 
Line Number: 12
 
Fatal error: Call to a member function get() on a non-object in F:\php\PHPsev\APMServ5.2.0\www\htdocs\system\application\models\Get_info.php on line 12
 
复制代码
发表于 2008-7-26 12:43:04 | 显示全部楼层
index 你给参数了吗?需要通过 index.php/welcome/index/参数  来给

本版积分规则