您可以在此处找到如何保存文件:如何将DOMPDF生成的内容保存到文件中?
$html =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$output = $dompdf->output();
file_put_contents('Brochure.pdf', $output);
Run Code Online (Sandbox Code Playgroud)
使用CakeEmailL发送电子邮件非常简单.看看这里:http: //book.cakephp.org/2.0/en/core-utility-libraries/email.html#sending-attachments
$Email = new CakeEmail();
$Email->from(array('me@example.com' => 'My Site'));
$Email->to('you@example.com');
$Email->subject('About');
$Email->attachments('/full/file/path/Brochure.pdf');
$Email->send('My message');
Run Code Online (Sandbox Code Playgroud)