我有一个控制器
<?php
class Onetimescan extends CI_Controller{
public function index() {
#LOAD MODEL
$this->load->model('scanmodel');
$this->scanmodel->loadurlbasedonsessid($this->session->userdata('session_id'));
}
}
?>
和一个模型:
<?php
class Scanmodel extends CI_Model{
function __construct(){
// Call the Model constructor
parent::__construct();
}
function loadurlbasedonsessid($sid){
$sid = $this->session->userdata('session_id');
$this->db->select('tld');
$this->db->where('session_id', $sid);
$q = $this->db->get('ClientDomain');
$r = $q->result_array();
echo($r[0]['tld']);
}
}
?>
我收到以下错误:
Call to a member function userdata() on a non-object
我以为我在 and 之间正确传递了,session_id
但事实并非如此?有人可以帮忙吗?controller
model
谢谢