2013-09-30 120 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

明白了。谢谢。输入错误。 –