我正在尝试下载数据,但由于某种原因无法正常工作
看法
@foreach($files as $file)
{!! Html::link('public/'.$file->name, $file->name) !!}
@endforeach
控制器
public function download($file_name){
$file_path = public_path('/'.$file_name);
return response()->download($file_path);
}
路线
Route::get('download/{file}','FilesController@download');
我得到这个错误
NotFoundHttpException in RouteCollection.php line 161
in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 821
at Router->findRoute(object(Request)) in Router.php line 691
路径错误,您正在观察/download/{file}
但正在呼叫/public/{file}
。
{!! Html::link('download/'.$file->name, $file->name) !!}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句