Codeigniter模型未定义的属性 [英] Codeigniter model Undefined property

查看:172
本文介绍了Codeigniter模型未定义的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在控制器文件中有以下代码,用于检查post varible pdf并执行以下代码

i have following code in the controller file which check for post varible pdf and execute following code

if(isset($_POST['pdf']) && $_POST['pdf']=="pdf")
            {
                $this->load->model('voutput_model');
                $final_view = $data['frmReport'];
                $PDF_Name = "report.pdf";
                $this->votput_model->pdf($PDF_Name,$final_view);

            }

我在模型文件中有以下代码

I have following code in model file

class Voutput_model extends CI_Model{

    public function __construct()
    {
        parent::__construct();
        $this->CI = get_instance();
    }

    public function pdf($file_name,$filecontents){
        $this->pdf_path = $this->config->item('pdf_path');
        $this->load->library('htmltopdf/Html2fpdf');
        $file['Attach_path'] = $this->pdf_path.$file_name;
        $this->html2fpdf->generate_pdf($file['Attach_path'],$filecontents,'Y');
    }
}

Severity: Notice
Message: Undefined property: Voutput::$Voutput_model
Filename: controllers/voutput.php
Fatal error: Call to a member function pdf() on a non-object in 
            C:\xampp\htdocs\asset\application\controllers\voutput.php 


推荐答案

尝试此

 $this->load->model('votput_model');
 $this->votput_model->pdf($PDF_Name,$final_view);

这篇关于Codeigniter模型未定义的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆