2013-09-30 39 views
0

我有一個模型product_model,我正在加載控制器功能刪除。當我運行該項目時,出現錯誤「調用第173行的/home/danish/www/hbs/application/controllers/admin.php中的非對象上的成員函數delete_merchant_products()」。我很困惑爲什麼會發生這種情況。下面是cotroller功能代碼。型號名稱是product_model。不加載codeigniter模型

function delete(){ 
    // deleting the merchant data. 
      $this -> load -> model('merchant_model'); 

      $output = $this -> merchant_model -> get_records(); 

      $list['merchants'] = $output; 

      $this->load->helper(array('form','url')); 

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

      $this->form_validation->set_rules('txt_merchant_title','Merchant Title','required'); 
      if($this->form_validation->run() == FALSE): 

       $this->load->view('admin/merchant_delete_view',$list); 
      else: 
       $merchant_title = $this->input->post('txt_merchant_title'); 

           $merchant_title = str_replace("-", " ", $merchant_title); 

       $temp_path = realpath('../hbs/merchants'); 

       $dir = $temp_path .'/'.$merchant_title .'/'; 

       system("rm -rf ".escapeshellarg($dir)); 

       $this->load->model('product_model'); 
       $this->porduct_model->delete_merchant_products($merchant_title);//error. 
       $this->merchant_model->delete($merchant_title); 
       echo "Delete successfully"; 
      endif; 

    } 

回答

1

你必須在這條線一個錯字:

$this->porduct_model->delete_merchant_products($merchant_title);//error. 

porduct,而不是產品。

+0

請詳細說明錯字?我不明白。 –

+0

明白了。謝謝。輸入錯誤。 –