我在codeIgniter中创建自己的库

时间:2015-03-23 06:33:15

标签: php codeigniter

我得到Unable加载请求的类:url

我的库代码是:-Curl_lib.php

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

控制器代码是:

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

1 个答案:

答案 0 :(得分:3)

试试吧

Url不是图书馆。它是助手类

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