2016-06-20 4 views
0

こんにちは私はcodeigniterファイル内の特定のディレクトリにdompdfを保存し、保存したファイルを電子メールとして送信しようとしています。私はこの作業をすべて行うためにcodeigniterを使用しています。 ここに関数があります。指定されたディレクトリにDOMPDFを保存してから電子メールで送信する

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); 



    } 

私は取得していますエラーが Message: file_put_contents(C:\Apache24\htdocs\faceloan\faceloan\application/third_party/pdf/): failed to open stream: No such file or directory ということですが、ディレクトリが存在しない、とパス名は正しいです。

答えて

1

パス.../third_party/pdf/はおそらくディレクトリであり、ファイルではありません。 PHPはデータをディレクトリとして保存できません。最初のパラメータとしてファイル名をfile_put_contents()と指定します。 third_party/pdf/my_document.pdf

+0

ありがとうございました! –

関連する問題