在Laravel 4.0中,我正在尝试为位于的 pdf 创建一个(强制)下载链接public/assets/files/cvde.pdf
风景:
<a href="curry/cvde">deutsch</a>
路线:
Route::get('curry/{file}', 'HomeController@downloadCV');
控制器方法:
public function downloadCV($file) {
return Response::download(public_path() . '/assets/files/' . $file . '.pdf', array(
'Content-Type'=>'application/octet-stream',
'Content-Disposition'=>'attachment; filename="' . $file . '.pdf"'
)
);
}
我收到 500 错误,并且浏览器指向public/curry/cvde
.
我究竟做错了什么?