2017-02-25 83 views
0

我正在使用來自codeigniter控制器的函數,該函數調用一個叫做付款計劃的模型供我使用。我一直在使用這種方法,但這是我第一次遇到問題。錯誤是 Fatal error: Call to a member function createPaymentPlan() on a non-object in 我不知道我在做什麼錯,但這裏是代碼。致命錯誤:加載codeigniter模型

  $this->load->model("payment_plan"); 
      $this->load->model("fee_page"); 

      foreach ($itemdetails as $itemdetail) { 
       $Amount = $itemdetail["borrowOrInvestAmount"]; 
       $currency = $itemdetail["Currency"]; 
       $Interest = $itemdetail["Interest"]; 
       $Loantime = (isset($data['Loantime']) && $data['Loantime'] > 0) ? $data['Loantime'] : $itemdetail["Loantime"]; 
       $start_date = $data["start_date"]; 
       $payment_term = $data["payment_term"];     

       $paymenPlanSingle = $this->payment_plan->createPaymentPlan($Amount, $currency, $Interest, $Loantime, $start_date, $payment_term); 
       $countOfElements = count($paymenPlanSingle); 
      } 

第二個達到payment_plan它崩潰,即使我已經加載控制器。

回答

1

一切看起來都正常。大多數情況下,此問題是由於之前加載了控制器而發生的。檢查您是否要加載任何控制器,如果是,請在它之前加載型號爲"payment_plan"的型號。

0

檢查控制器不會覆蓋VAR

$this->payment_plan 

如果你能證明的控制器和模型payment_plan