|
本帖最后由 class 于 2013-1-15 20:50 编辑
<?php
class Collectlink extends CI_Controller {
public function __construct() {
parent::__construct();
//加载采集类
$this->load->library('collect_general');
}
public function start($key = false) {
if (!file_exists('app/views/collectlink.php')) {
show_404();
}
if ($key === false) {
$data['info'] = '参数错误!';
$data['title'] = '采集页面地址';
$this->load->view('collectlink', $data);
} else {
$this->load->model('collect_model');
$data = $this->collect_model->get_collect_by_key($key);
$this->load->model('collectlink_model');
}
}
}
model页面
<?php
class Collect_model extends CI_Model {
public function __construct() {
$this->load->database();
}
public function get_collect_by_key($key) {
$query = $this->db->get_where('collect', array('collect_id'=>$key));
return $query->row_array();
}
}
错误信息:
Severity: Notice
Message: Undefined property: Collectlink:collect_model
Filename: controllers/collectlink.php
Fatal error: Call to a member function get_collect_by_key() on a non-object in E:\wwwphp\controllers\collectlink.php on line 26
控制器中载入当前模型是没有问题的 载入别的模型就会这样了
是不是我载入模型的方法错了
求高人指点
|
|