当我将表单结果从联系表单7导出为PDF(fPDF)时。然后我们的联系表格7文件上传没有显示在联系表格7消息正文中。意味着两个附件文件都没有正确显示如何解决这个问题。我正在使用我的代码创建一个pdf,然后将其附加到我的电子邮件,工作正常,但当我从联系表单7前端上传文件然后我们的PDF文件没有显示。我的代码是:
add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' );
function mycustom_wpcf7_mail_components($components){
if (!empty($components['attachments'])) {
//$components['attachments'] = array( 'attachedfile' => FPDF_PATH.'/dompdf-master/'.'Shoop.pdf'); // ATTACH THE NEW PDF THAT WAS SAVED ABOVE
$components['attachments'] .= array(FPDF_PATH .'/dompdf-master/'.'Shoop.pdf'); // ATTACH THE NEW PDF THAT WAS SAVED ABOVE
}
return $components;
}
答案 0 :(得分:-2)
转换:
$components['attachments'] .= array(FPDF_PATH .'/dompdf-master/'.'Shoop.pdf');
要:
$components['attachments'][] = FPDF_PATH .'/dompdf-master/'.'Shoop.pdf';