Laravel 4 使用dom pdf时在laravel中获取空白页
我正在使用带有dompdf的Laravel4.2。 我的控制器:Laravel 4 使用dom pdf时在laravel中获取空白页,laravel-4,dompdf,Laravel 4,Dompdf,我正在使用带有dompdf的Laravel4.2。 我的控制器: public function getLedgerReport() { $pdf = PDF::loadView('sales.ledger_report')->setPaper('a4'); $pdf->stream(); } 我的看法是: <?php ini_set('max_execution_time', 300); //300 seconds = 5 minutes $html =
public function getLedgerReport() {
$pdf = PDF::loadView('sales.ledger_report')->setPaper('a4');
$pdf->stream();
}
我的看法是:
<?php
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
$html = '';
$html .= '<html><body>hi</body></html>';
echo $html;
?>
我得到的是一张空白页,而不是一条“你好”的短信。
但当我将其保存为pdf文件时,我确实会在文件中看到一个“hi”。检查apache错误日志。
public function getLedgerReport() {
$pdf = PDF::loadView('sales.ledger_report')->setPaper('a4');
$pdf->stream();
$invoice_path = 'downloads/invoices/invoice.pdf';
$pdf->save($invoice_path);
}