알림

2017-05-03 1 views
0

나는이 내보기 nombre.php이다이 enter image description here알림

같은 통지의 번호가 표시됩니다 때 문제가/core :

<?php 
    class Controller extends ci_controller{ 

    static function &get_instance() 
    { 
     return CI_Controller::get_instance(); 
    } 
} 

?> 
+0

https://www.codeigniter.com/user_guide/general/creating_libraries.html?highlight=library 및 https://www.codeigniter.com/user_guide/general/controllers.html#class-constructors – user4419336

답변

1

질문이 명확하지 않습니다. 그러나 프레임 워크를 올바르게 사용하지 않습니다. 이 방법으로 시도 : 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); 
    } 

} 

APPPATH.'views에서을/어떤/index.php에이'

<?php 
var_dump($notifications); 

당신은 오류의 여지가 그 코딩 범위를 벗어났습니다. 프레임 워크가 요구하는 코딩 표준 (즉, 파일명/클래스 명)을 확인하십시오. Docs.