我想嘗試使用HTML到PDF在laravel 4.2中生成報告。我遵循了這裏的指示。語法錯誤,意想不到的'foreach'HTML to PDF with Laravel 4.2
syntax error, unexpected 'foreach' (T_FOREACH)
這裏是我的代碼:
public function download($code){
$buckets = DB::table('buckets')->where('code',$code)->get();
$html = "<p>Code : ".$code."</p>
<p>Name : Febry Fairuz</p>".
foreach ($buckets as $bd) {
"<p>".$bd->id_rent."</p>".
}
"<p>".$bd->created_at."</p>";
return PDF::load($html, 'A4', 'portrait')->download('my_pdf');
}
THX大..它的工作.. – 2014-12-07 14:08:33
歡迎您:) – MH2K9 2014-12-07 14:13:24