这是我的代码
public function build(){
return $this->view('senderMail.mail')->to('example@admin.com')->attachData("Just test for PDF", "Receipt.pdf",['mime' =>'application/pdf',]);
}
使用dompdf laravel软件包
public function build(){
$pdf = PDF::loadView('senderMail.mail');
$data = $pdf->output();
return $this->view('senderMail.mail')
->to('example@admin.com')
->attachData($data, "Receipt.pdf",
['mime' =>'application/pdf',]);
}