Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将DOMPDF保存到指定目录,然后作为电子邮件发送_Php_Codeigniter_Dompdf - Fatal编程技术网

Php 将DOMPDF保存到指定目录,然后作为电子邮件发送

Php 将DOMPDF保存到指定目录,然后作为电子邮件发送,php,codeigniter,dompdf,Php,Codeigniter,Dompdf,您好,我正在尝试将dompdf保存到codeigniter文件中的特定目录,然后将保存的文件作为电子邮件发送。我正在使用codeigniter来完成所有这些工作。 下面是函数 public function generateCreditAggreement(){ $this->load->helper('file'); require_once(APPPATH.'third_party/dompdf/dompdf_config.inc.php');

您好,我正在尝试将dompdf保存到codeigniter文件中的特定目录,然后将保存的文件作为电子邮件发送。我正在使用codeigniter来完成所有这些工作。 下面是函数

public function generateCreditAggreement(){
        $this->load->helper('file'); 
        require_once(APPPATH.'third_party/dompdf/dompdf_config.inc.php');

        $pdfroot  = dirname(dirname(__FILE__));
        $pdfroot .= '/third_party/pdf/';

        $dompdf = new Dompdf();


        $msg = $this->load->view('credit_agreement_view', '', true);
        $html = mb_convert_encoding($msg, 'HTML-ENTITIES', 'UTF-8');
        $dompdf->load_html($html);

        $paper_orientation = 'Potrait'; 
        $dompdf->set_paper($paper_orientation);

            // Render the HTML as PDF
        $dompdf->render();

            // Output the generated PDF to Download folder

//          $dompdf->stream('document.pdf');

            //save the pdf file on the server
            $pdf_string =   $dompdf->output();
            file_put_contents($pdfroot, $pdf_string ); 



    }
我得到的错误是
消息:文件内容(C:\Apache24\htdocs\faceloan\faceloan\application/third\u party/pdf/):无法打开流:没有这样的文件或目录

但是目录确实存在,路径名是正确的。

路径
../third\u party/pdf/
可能是一个目录而不是一个文件。PHP无法将数据保存为目录。指定文件名作为
file\u put\u contents()
的第一个参数,例如
third\u/pdf/my\u document.pdf
路径
../third\u/pdf/
可能是一个目录而不是文件。PHP无法将数据保存为目录。指定文件名作为
文件内容()的第一个参数,例如
第三方/pdf/my\u document.pdf