我正在尝试在Laravel 4中的发送邮件中附上一个PDF文件,但我似乎无法正常工作。此设置不会返回任何错误或任何内容,只是在空白屏幕上停止。电子邮件服务器设置正确,刀片式视图工作正常。PDF创建者也在工作。
我在这里做错了什么?我对Laravel和PHP很陌生。感谢您提供的任何帮助或指导!
public function getPdf()
{
define('INCLUDE_PATH', '/home/dsimedic/apm/vendor/dompdf/dompdf');
@ini_set("include_path", INCLUDE_PATH);
require_once('dompdf_config.inc.php');
$apmformdata = Session::get('apmform');
$html = View::make('formPdf')
->with('apmformdata', $apmformdata);
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$pdf = $dompdf->output();
$file_to_save = './pdf/'.$apmformdata->JobNumber.'.pdf';
file_put_contents($file_to_save, $pdf);
if (($apmformdata->id) != "")
{
$status = 'updated';
Mail::later(20,'emails.formFollowup', array('status'=>$status, 'JobNumber'=>$apmformdata->JobNumber), function($message) {
$message->to('name@domain.com', 'My Name')
->subject('APM Form Alert Notice')
->attach(use ($file_to_save));
});
}
else
{
$status = 'created';
}
return Redirect::to('/')
->with('flash_notice', 'APM Form: '.$apmformdata->JobNumber.' has been '.$status.'! <br/>You will recieve an email with a PDF copy of the form shortly!');
}