Php 带有codeigniter错误的通知
我有一个问题,当我将显示这样的通知数量 这是我对nombre.php的看法:Php 带有codeigniter错误的通知,php,codeigniter,Php,Codeigniter,我有一个问题,当我将显示这样的通知数量 这是我对nombre.php的看法: <?php $CI =& get_instance(); $CI->load->model("notif_model"); $notification = new notif_model(); $notifications = $notification->countNotif(); echo $notifications; ?>
<?php
$CI =& get_instance();
$CI->load->model("notif_model");
$notification = new notif_model();
$notifications = $notification->countNotif();
echo $notifications;
?>
并在application/core中创建文件controller.php:
<?php
class Controller extends ci_controller{
static function &get_instance()
{
return CI_Controller::get_instance();
}
}
?>
这个问题有点不清楚。然而,您并没有以正确的方式使用框架。试着这样做: 在APPPATH.controllers/Some_controller.php中
<?php
class Some_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model("notif_model");
}
public function index()
{
$data['notifications'] = $this->notif_model->countNotif();
$this->load->view('some/index', $data);
}
}
和
<?php
var_dump($notifications);