require_once ROOTPATH . 'tcpdf/vendor/autoload.php';$html='';if($html){ mpdf($html); }else{ echo "下载失败,请选择资源"; die(); } function mPdf($html, $fileName = 'dome', $dest = "D") { $mpdf = new \Mpdf\Mpdf(); $mpdf->SetDisplayMode('fullpage'); $mpdf->autoScriptToLang = true; $mpdf->autoLangToFont = true; $mpdf->WriteHTML($html); $mpdf->Output($fileName . ".pdf", $dest); // 输出pdf文件(必须写exit结束,否则会出现下载正常,预览全部乱码问题) exit(); }
标签:Mpdf,mpdf,导出,html,exit,pdf,php From: https://www.cnblogs.com/lhjy1/p/16892228.html