我有一个模型 product_model 我正在加载控制器功能删除。当我运行该项目时,我收到错误“在第 173 行的 /home/danish/www/hbs/application/controllers/admin.php 中的非对象上调用成员函数 delete_merchant_products()”。我很困惑为什么会这样。下面是控制器功能代码。型号名称是 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;
}