Vishnu Pratap
Vishnu Pratap

Reputation: 85

I create my own library in codeIgniter

I'm getting the Unable to load the requested class: url

my library code is :-Curl_lib.php

<?php
class Curl_lib
{
    function hello()
    {
        $CI = & get_instance();
        $CI->load->library('url');
        $msg = "Hello";  
        return $msg;
    }
}
?>

Controller code is:

<?php
class Curl extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->library('curl_lib');
        $this->load->helper('url');
    }
    function get_content()
    {  
        $message = $this->curl_lib->hello();
        echo $message;    
    }
}
?>

Upvotes: 1

Views: 724

Answers (1)

Jay Dhameliya
Jay Dhameliya

Reputation: 1699

Try it

Url is not Library. it is Helper class.

<?php
class Curl_lib
{
    function hello()
    {
        $CI = & get_instance();
        $CI->load->helper('url');
        $msg = "Hello";  
        return $msg;
    }
}
?>

Upvotes: 3

Related Questions