【发布时间】:2018-03-02 23:14:49
【问题描述】:
我正在使用 dompdf 生成 pdf,我需要将其附加到 phpmailer 并邮寄。 我们将不胜感激。
<?php
require_once("../../dompdf/dompdf_config.inc.php");
$templateFile = 'prog_report.php';
$content = file_get_contents($templateFile);
$dompdf = new DOMPDF();
$dompdf->load_html($content);
$dompdf->render();
$dompdf->stream("sample.pdf");
?>
这是 phpmailer 附件模块..
$mail->AddAttachment("images/phpmailer.gif");
我想在此处附上生成的 pdf,该 pdf 不应该保存在硬盘驱动器上。
【问题讨论】:
-
你得到这个问题的答案了吗
-
是的,将pdf复制到变量$pdf=$dompdf->output();然后使用以下代码将其附加到邮件中 $mail->AddStringAttachment($pdf, 'filename.pdf');
-
@Venkat : 我需要一些关于 php 的信息,我可以联系你吗?或在 FB 上找到你
-
您可以联系我@venkatakrishnabtech@gmail.com .......或者也可以在 Fb 中使用该电子邮件 ID 搜索我