Код: Выделить всё
class Blogmodel extends CI_Model
{
public function get_recent_post($num)
{
$query = $this->db->get('wdr_blog_post', $num);
return $query->result();
}
}
Код: Выделить всё
class Blog extends CI_Controller
{
public function index()
{
$this->load->model('blogmodel');
$posts = $this->Blogmodel->get_recent_post(5);
}
}
Обнаружена ошибка PHP
Серьезность: уведомление
Сообщение: неопределенное свойство: Blog::$Blogmodel
Имя файла: контроллеры/blog.php
Номер строки: 7
Неустранимая ошибка: вызов функции-члена get_recent_post() для объекта, не являющегося объектом, в G:\server\htdocs\xyz\app\controllers\blog.php в строке 7
Подробнее: https://stackoverflow.com/questions/227 ... odeigniter
Мобильная версия