Model类function问题,新手求助
RT,User_model.phpfunction count_users()
{
$query_user=$this->db->query("SELECT * FROM `users` LIMIT 0, 30 ");
return $query_user->num_rows();
}
Home.php
public function index()
{
$this->output->enable_profiler(TRUE);
$this->load->model('User_model');
$this->load->database();
$this->load->helper('url');
$data['user_num'] = $this->User_model->count_users;
$this->load->view('header_view',$data);
$this->load->view('index_view');
$this->load->view('footer_view');
}
报错:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Home::$count_users
Filename: core/Model.php
Line Number: 51
求除错、求解决,帮忙者送几个积分 count_users后面要加括号吧。 同意沙发的见解。
页:
[1]