0
嗨我想將dompdf保存到codeigniter文件中的特定目錄,然後將保存的文件並將其作爲電子郵件發送。我使用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
但目錄確實存在,而且路徑名是正確的。
謝謝了! –