Codeigniter cannot load library

I have a problem that I cannot load my library into my controller: S

I got this error: Message: Undefined property: Profil :: $ profileWall

My library:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class ProfileWall { private $CI; public function __construct() { $this->CI =& get_instance(); } public function wallShow() { $this->CI->load->model('profil_model'); return $this->CI->profil_model->wallGet($this->CI->uri->segment(3)); } } 

and my controller

  function index() { $this->load->model('profil_model'); $data['query'] = $this->profil_model->vis_profil($this->uri->segment(3)); //Henter lib profilwall så man kan vise wall beskeder i profilen $this->load->library('profileWall'); $data['queryWall'] = $this->profileWall->wallShow(); $data['content'] = 'profil_view'; $this->load->view('includes/template', $data); } 

What am I doing wrong?

+4
source share
3 answers

Make sure that loading your library is always lowercase, in the Documentation , instances of instances will always be lower.

Also make sure your library file is named ProfileWall.php

example load $this->load->library('profilewall');

using $this->profilewall->function();

+17
source

The library in the code igniter was not concentrated in lower case, did you place your library in the application / library folder? before or try changing the class name with CI_ProfileWall

+2
source

I saved my files with CKEditor CKFinder in the / library folder. I changed the first letter of CKFinder to Ckfinder and CKEditor to Ckeditor. It works well.

In your Wall profile, this should be a profile profile

0
source

Source: https://habr.com/ru/post/1336707/


All Articles