codeigniter无法加载库 [英] codeigniter cannot load library

查看:96
本文介绍了codeigniter无法加载库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我不能加载我的控制器中的库:S



我有这个错误:消息:未定义的属性:Profil :: $ profileWall



我的图书馆:

 <?php if ('BASEPATH'))exit('不允许直接脚本访问); 

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));
}
}

和我的控制器

  function index()
{
$ this-> load-> model('profil_model');
$ data ['query'] = $ this-> profil_model-> vis_profil($ this-> uri-> segment(3));


// Henter lib profilwallså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);


}

p>

解决方案

请确保您的库加载始终以小写形式,文档,对象实例总是小写的。



还要确保您的库文件大写 ProfileWall.php



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



使用 $ this-> profilewall-> function(); / p>

I have a problem that I can't load my library in 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?

解决方案

Make sure your library loading is always done in lowercase, per the Documentation, object instances will always be lower case.

Also make sure your library file is capitalized ProfileWall.php

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

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

这篇关于codeigniter无法加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆