未加载codeigniter模型

时间:2013-09-30 18:35:08

标签: codeigniter

我有一个模型product_model,我在控制器函数delete中加载。当我运行项目时,我在第173行的/home/danish/www/hbs/application/controllers/admin.php中的非对象上调用了“调用成员函数delete_merchant_products()”。我很困惑为什么会这样。下面是cotroller功能代码。型号名称为product_model。

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 个答案:

答案 0 :(得分:1)

你在这一行上有一个错字:

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

产品而非产品。