CodeIgniter奇怪的问题无法解决

时间:2015-04-15 18:11:23

标签: php codeigniter model controller

CodeIgniter这是一个非常令人烦恼和奇怪的问题我试图在新的CodeIgniter项目中使用WHMCS API,但我一直收到以下错误

Fatal error: Call to a member function getTickets() on a non-object

Undefined property: Whmcs::$whmcs

我的控制器getTickets功能是

 function getTickets(){
        if(!empty($_SESSION['logged_in'])){
            $id = $_SESSION['userid'];
            $this->load->model('app/whmcs_model');
            $arr['client'] = $this->whmcs_model->getTickets($id);
            $this->load->view('app/getTickets', $arr);
        }else{
            redirect('/user/login/', 'refresh');
        }
    }

我的模型getTickets函数是

function getTickets($id){
        $this->load->library('whmcs');
        return $this->whmcs->getTickets($id);
    }

我的WHMCS库getTickets函数是

public function getTickets($clientid){
        $postfields["action"] = "gettickets";
        $postfields["clientid"] = $clientid;
        $arr = $this->xml($postfields);
        return $arr;
    }

之前确实有效,但我决定将所有WHMCS功能移动到单个模型和控制器中,因为该库已经在自己的库中

现在它只是抛出上述错误,请帮助它已经两天了,我没有在哪里。

whmcs.php控制器和whmcs_model.php位于文件夹应用中,我知道问题可能在

$this->load->library('whmcs');

然而,我不确定为什么这会导致问题,因为之前所有代码都有效,我已尝试运行调试,并且此顺序中出现以下错误

   Config Class Initialized
   Hooks Class Initialized
   UTF-8 Support Enabled
   Utf8 Class Initialized
   URI Class Initialized
   Router Class Initialized
   Output Class Initialized
   Security Class Initialized
   Global POST, GET and COOKIE data sanitized
   Input Class Initialized
   Language Class Initialized
   Loader Class Initialized
   Helper loaded: url_helper
   Helper loaded: utility_helper
   Database Driver Class Initialized
   Session: Class initialized using 'database' driver.
   Controller Class Initialized
   Model Class Initialized
   Model Class Initialized
   Whmcs class already loaded. Second attempt ignored.
   Undefined property: Whmcs::$whmcs
   Call to a member function getTickets() on a non-object

这和我收集的信息一样多,希望某个地方有人可以解决这个问题,已经有三天了,我几乎无处可去。

我期待你的回复

0 个答案:

没有答案