Php 通过电子邮件从动态生成的页面发送使用html2pdf生成的PDF

Php 通过电子邮件从动态生成的页面发送使用html2pdf生成的PDF,php,codeigniter,html2pdf,Php,Codeigniter,Html2pdf,因此,我使用codeigniter生成了一个页面。 我想发送一封附有PDF格式页面的邮件,但我也不想将其保存在服务器上。 我发现了两个代码资源,它们看起来正是我所需要的: <?php $content = " <page> <h1>Exemple d'utilisation</h1> <br> Ceci est un <b>exemple d'utilisation</b> de

因此,我使用codeigniter生成了一个页面。
我想发送一封附有PDF格式页面的邮件,但我也不想将其保存在服务器上。
我发现了两个代码资源,它们看起来正是我所需要的:

<?php
    $content = "
<page>
    <h1>Exemple d'utilisation</h1>
    <br>
    Ceci est un <b>exemple d'utilisation</b>
    de <a href='http://html2pdf.fr/'>HTML2PDF</a>.<br>
</page>";

    require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php');
    $html2pdf = new HTML2PDF('P','A4','fr');
    $html2pdf->WriteHTML($content);
    $html2pdf->Output('exemple.pdf');
?>

我向您发送带有dom pdf的代码,其中电子邮件发送带有pdf,发送电子邮件后删除pdf

    ob_start();
set_include_path(get_include_path() . PATH_SEPARATOR . "/path/to/dompdf");
require_once APPPATH . "core/dom_pdf/dompdf_config.inc.php";


$dompdf = new DOMPDF();
$dompdf->set_paper(DEFAULT_PDF_PAPER_SIZE, 'A4');
$dompdf->load_html($message);

$dompdf->render();

$output = $dompdf->output();
file_put_contents('pdf_name.pdf', $output);

$this->load->library('email');
$config = array (
'mailtype' => 'html',
'charset'  => 'utf-8',
'priority' => '1'
);
$this->email->initialize($config);

$this->email->from('admin@admin.com', 'Admin');
$this->email->to(Reciever email); 
$this->email->subject('Subject');
$this->email->message($message); 

$this->email->attach(FCPATH."pdf_name.pdf");
$this->email->send();
   <!-- If you want to delete file after send email --> 
unlink(FCPATH."pdf_name.pdf");
ob_start();
设置包含路径(get包含路径().path分隔符。“/path/to/dompd”);
需要一次APPPATH。“core/dom_pdf/dompdf_config.inc.php”;
$dompdf=新的dompdf();
$dompdf->设置纸张(默认的纸张大小为“A4”);
$dompdf->load_html($message);
$dompdf->render();
$output=$dompd->output();
文件内容('pdf\u name.pdf',$output);
$this->load->library('email');
$config=array(
“邮件类型”=>“html”,
“字符集”=>“utf-8”,
“优先级”=>“1”
);
$this->email->initialize($config);
$this->email->from($this)admin@admin.com","行政",;
$this->email->to(收件人电子邮件);
$this->email->subject('subject');
$this->email->message($message);
$this->email->attach(FCPATH.pdf_name.pdf”);
$this->email->send();
取消链接(FCPATH.“pdf_name.pdf”);
我认为您需要取消链接(FCPATH.pdf\u name.pdf);
    ob_start();
set_include_path(get_include_path() . PATH_SEPARATOR . "/path/to/dompdf");
require_once APPPATH . "core/dom_pdf/dompdf_config.inc.php";


$dompdf = new DOMPDF();
$dompdf->set_paper(DEFAULT_PDF_PAPER_SIZE, 'A4');
$dompdf->load_html($message);

$dompdf->render();

$output = $dompdf->output();
file_put_contents('pdf_name.pdf', $output);

$this->load->library('email');
$config = array (
'mailtype' => 'html',
'charset'  => 'utf-8',
'priority' => '1'
);
$this->email->initialize($config);

$this->email->from('admin@admin.com', 'Admin');
$this->email->to(Reciever email); 
$this->email->subject('Subject');
$this->email->message($message); 

$this->email->attach(FCPATH."pdf_name.pdf");
$this->email->send();
   <!-- If you want to delete file after send email --> 
unlink(FCPATH."pdf_name.pdf");